I'm looking to center an icon within a bootstrap-5
card image. I have an icon that I want to display at the center of my card image, but I'm unsure how to achieve this using either CSS
or Bootstrap-5
. Can anyone provide guidance on how to accomplish this? I've tried implementing methods from this source, but the image is not contained in a card. Another attempt with this method also failed because the image was not placed within a card.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Videos</title>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c5a7aaaab1b6b1b7a4b585f0ebf5ebf7">[email protected]</a>/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c3a1acacb7b0b7b1a2b3eeaaa0acadb083f2edf2f3edf7">[email protected]</a>/font/bootstrap-icons.css">
</head>
<style>
.image-thumbnail{
object-fit: cover;
height: 100%;
}
.my_card{
height: 100%;
}
</style>
<body class="m-5">
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="card">
<div class="card-body">
<a href="">All</a>
<a href="">All</a>
<a href="">All</a>
</div>
</div>
</div>
<div class="col-md-9">
<div class="row">
{% for video in my_videos %}
<div class="col-md-4 my-2">
<a href="{% url 'Play-Video' video.slug %}">
<div class="card my_card">
<img class="image-thumbnail" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSnkEY_ZgFq4R5FRz-4d9iamx8OKOhneZTm5vKRkwizmnycE-9uI6Tea6AHLQmm5qPq_xg&usqp=CAU" alt="">
<i style="font-size: 60px;" class="bi bi-play"></i>
<div class="card-body">
<img src="" alt="">
<p class="card-title">
{{ video.title }}
</p>
</div>
</div>
</a>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
<div class="container">
<div class="row justify-content-center">
<nav aria-label="...">
<ul class="pagination">
<a class="page-link" href="">1</a>
</ul>
</nav>
</div>
</div>
</body>
</html>