Currently, I am working on customizing the theme of a website and have encountered an issue with an image that is cropped vertically within a div. You can check out the codepen or example below: https://codepen.io/hioioasd90/pen/LzvmpW
I want the full image to be displayed while also being scaled to fit the width of the container. Modifying the CSS in Chrome console by increasing the height: 27vh;
value shows more of the image inside the div but it starts overflowing the max width boundaries.
.container {
max-width: 1000px;
margin: 0 auto;
position: relative;
}
.img-cover-category {
background: none no-repeat center center;
-moz-background-size: cover;
-o-background-size: cover;
-webkit-background-size: cover;
background-size: cover;
position: relative;
z-index: 0;
padding: 0;
height: 27vh;
width: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
margin-bottom: 0px;
}
<div class="container">
<div class="img-cover-category" style="background-image: url(https://writernikhilpro01.files.wordpress.com/2015/08/unsplash-laptop-desk.jpg);"></div>
</div>