I have a div wrapping two images. I want the second image to fit within the div because the width and height are dynamic.
My code looks like this:
.box {
width: 640px;
height: 540px;
float: left;
overflow: hidden;
}
.img-border {
width: 100%;
height: 100%;
display: block;
border-radius: 20px;
margin: 5px;
}
<div class="box" id="target">
<div align="center">
<img src="http://cdn.tgdd.vn/Files/2014/06/24/551004/game-duoi-hinh-bat-chu4.jpg" width="60%" height="60%">
</div>
<img class="img-border" id="imgQues" src="https://4.bp.blogspot.com/-K5SwATiq6cI/U84bk7MZPWI/AAAAAAAADkI/4lWV0ErVAFs/s1600/2014-07-22+14.11.00-1.png" />
<div class="comment" id="chatbox">
</div>
</div>
The problem you can see at .img-border
is not fitting (stretch and resize) into .box
div and keeping its aspect ratio.
Is there any method to fit the second image img-border
in div and keep ratio?