Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

yakov sachuk
yakov sachuk
4,768 Points

How can I resize a background-image of some section without change size of section's border?

my goal is zooming an all image when the user locate his cursor, without changing the original border. like at this site : http://edu.gov.il/owlheb/Pages/default.aspx.

2 Answers

You can wrap your image in a container and use use css scale on the image.

Here is a quick example:

<div class="img-wrapper">
    <img class="grow-img" src="https://picsum.photos/200/300">
</div>
.img-wrapper {
    display: inline-block;
    overflow: hidden;
}

.grow-img { 
    transition: all .2s ease-in-out; 
}
.grow-img:hover { 
    transform: scale(1.1); 
}
yakov sachuk
yakov sachuk
4,768 Points

Great,it works ,thanks!