-3

How do you crop the image with CSS/coding? Or how can I find tutorials on it?

So I don't want the image to be resized, but to be "cut off"

rhgb
  • 4,075
  • 2
  • 21
  • 28
user1861212
  • 17
  • 1
  • 6

1 Answers1

1

the image itself will not zoom if you do not apply width or height attribute/style on it.

resize the container, apply height and width style on it, together with overflow:hidden.

example:

<div class="image-container">
    <img src="http://example.com/some-image.png" alt="example"/>
</div>

and css:

.image-container {
    width: 300px;
    height: 200px;
    overflow: hidden;
}

further, if you want to adjust position of the image, apply position: relative and top bottom left right on it:

.image-container img {
    position: relative;
    left: 20px;
    top: -50px;
}
rhgb
  • 4,075
  • 2
  • 21
  • 28