Quantcast
Channel: HTML – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 60

html – CSS Display an Image Resized and Cropped – Stack Overflow

$
0
0

[WayBack] html – CSS Display an Image Resized and Cropped – Stack Overflow (thanks [WayBack] roborourke!); see full answer link for runnable snippet and HTML (the WordPress editor keeps fucking up preformatted code blocks with html or XML in it).

You could use a combination of both methods eg.

    .crop {
        width: 200px;
        height: 150px;
        overflow: hidden;
    }

    .crop img {
        width: 400px;
        height: 300px;
        margin: -75px 0 0 -100px;
    }

You embed the img in a div with class .crop, or in-line the styles in the img and div tags.

–jeroen

 


Viewing all articles
Browse latest Browse all 60

Trending Articles