Hello i want to show the full image in a specified height div like this
<div style="width:400px"> <img class="images" src="someimage.jpg"> </div>
i tried this
.images
{
width: 100%;
height:auto;
}
Hello i want to show the full image in a specified height div like this
<div style="width:400px"> <img class="images" src="someimage.jpg"> </div>
i tried this
.images
{
width: 100%;
height:auto;
}
but it crops the image it doesnt show the full image in height and width
You say "in a specified height of div", but you havent specified a height on that div, so what's the problem?
Also what you have here on HTML & CSS, it doesn't crop the image.
https://codepen.io/gentlemedia/pen/xxxZzrq
Hi, please try this code:
HTML
<div>
<img src="https://www.w3schools.com/images/picture.jpg">
</div>
CSS
div {
width: 50px;
height: 50px;
}
div img {
height: 100%;
width: 100%;
}
i thing change some code.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.