The image is larger than 15px, so it is ou...">

Avoid the image going beyond the div?

I have:

<div style="height:15px"> <img src="image" /> </div> 

The image is larger than 15px, so it is outside the div when you see it. How to "crop" an image (show only its port 15px), only using css?

+6
html css crop
source share
6 answers

You need overflow:hidden see an example here:

http://www.jsfiddle.net/S8qAq/

Read about overflow : here W3Schools

Good luck

+9
source share

Try giving overflow:hidden div.

+3
source share

add overflow:hidden; into your div style.

+1
source share

Use the overflow css property:

 overflow: hidden; 
+1
source share

using

 overflow:hidden; 
+1
source share

I am surprised that no one suggested object-fit: cover;

0
source share

All Articles