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 How to Make a Website Responsive Web Design and Testing Build a Three Column Layout

Ray Kennedy
PLUS
Ray Kennedy
Courses Plus Student 2,982 Points

when using g percentage instead of px, you only need to specify width of the element and not the height?

you only need to have the width in percentage and not the the height for the element to scale properly? be cause in the video he does nothing to the pictures height only the width

3 Answers

If you leave the height as the default auto, it will keep the image's correct aspect ratio. Otherwise it will stretch the image based on the percentage of the containing element.

Hi Ray,

That's correct. The browser will automatically scale the height proportionally for you as the width of your image changes.

Hi Ray,

When we design for small devices we use % for width. If screen is hundred % we may want picture 50 % or 60 % it depends.