I'm currently working with bootstrap cards and I've been able to prevent the card image from overflowing outside of the card area. However, I'm facing an issue where the bottom of the image overflows into the card-body region. I'm not sure if there is a CSS attribute that can help prevent content from overflowing into the current div.
#services img {
object-fit: cover;
height : 15rem;
transition: transform 0.2s;
}
#services .card {
overflow: hidden;
padding : 0px 0px;
}
#services img:hover {
transform: scale(1.1);
}
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="593b36362d2a2d2b3829196c7768776a">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<div class="container py-5" id="services">
<div class="row pt-5">
<div class="col-md-6">
<div class="card shadow-sm">
<img src="https://media.istockphoto.com/photos/hot-air-balloons-flying-over-the-botan-canyon-in-turkey-picture-id1297349747?b=1&k=20&m=1297349747&s=170667a&w=0&h=oH31fJty_4xWl_JQ4OIQWZKP8C6ji9Mz7L4XmEnbqRU=" alt="...">
<div class="card-body">
<h5 class="card-title">Card Title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk
of the card's content.</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>