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


Responsive Web Design Best Practic

Is there a best practice for top and bottom margins and padding on responsive webdesign. Ie should I use em px or % or is it a case of a project by project decision.

6 Answers

Scott Paterson
Scott Paterson
26,869 Points

Spot on wondering this myself, i have been using percentages myself, always good to know, if doing things the right way or is it a case of if it solves the problem and job done?

James Barnett
James Barnett
39,199 Points

By definition a design not responsive unless it uses relative measurements (em or %) for layout.

Usually percentages are usually a better choice, as EMs (and REMs) are really meant for typography.

So I guess the % for the top margin is still the % of the container that the element is in

Guil Hernandez
Guil Hernandez
Treehouse Teacher

Graham Davidson - Yep, it's relative to the parent element. I also recommend % based values for both margins and padding, as James Barnett mentioned.

cool thanks all