I am looking to add a thumbnail with the duration displayed in the bottom right corner of a video, but I am facing issues moving the span object within the card using Bootstrap 4. Whenever I try to increase the margin-left beyond 50%, the span object crashes:
<!DOCTYPE html>
<html lang="en>
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<style>
.duration {
background-color: black;
color: white;
padding-left: 4px;
padding-right: 4px;
opacity: 0.7;
border-radius: 5px;
}
.card-img-overlay {
position: absolute;
margin-top: 75% !important;
margin-left: 51% !important;
margin-right: 0% !important;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="card img-fluid mt-2" style="width:200px">
<img class="card-img-top" src="https://www.w3schools.com/bootstrap4/img_avatar1.png" alt="Card image" style="width:100%">
<div class="card-body">
<p class="card-text">Example text here</p>
</div>
<div class="card-img-overlay">
<span class="duration">2:42:42</span>
</div>
</div>
</div>
</body>
</html>
EDIT: I managed to resolve this issue by updating the CSS in the following way:
.duration {
background-color: black;
color: white;
padding-left: 4px;
padding-right: 4px;
opacity: 0.7;
border-radius: 5px;
position: absolute;
top:65%;
left:68%;
}