Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.

ellie adam
ellie adam
26,376 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.