Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make images get cut off

Tags:

html

css

http://s1167.photobucket.com/user/unlivedgears/media/image-8.jpg.html?sort=3&o=1

http://s1167.photobucket.com/user/unlivedgears/media/image-9.jpg.html?sort=3&o=0

See On the first image how the girls head and legs are cut off because the image is too long for the square. How can I make it so that it cuts them both off and centers it? Or if it it too wide it will cut the sides off?

like image 526
Dylan Baker Avatar asked Apr 07 '13 18:04

Dylan Baker


People also ask

How do I cut out an image in Windows?

Select the picture that you want to remove the background from. On the toolbar, select Picture Format > Remove Background, or Format > Remove Background. If you don't see Remove Background, make sure you have selected a picture. You might have to double-click the picture to select it and open the Picture Format tab.


1 Answers

Assuming an HTML structure like this:

<div>
    <img />
</div>

Use this css:

div{
    height: 100px;
    width: 80px;
    overflow: hidden;
}

img{
    min-height: 100%;
    min-width: 100%;
}

Or, you could set the image as a background image and use background-size: cover

like image 97
Bill Avatar answered Oct 13 '22 01:10

Bill