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!

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
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.

ellie adam
ellie adam
26,377 Points

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.