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 trialGraham Davidson
Courses Plus Student 14,966 PointsResponsive 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
26,869 PointsSpot 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
39,199 PointsBy 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.
Scott Paterson
26,869 PointsThanks James
Graham Davidson
Courses Plus Student 14,966 PointsSo I guess the % for the top margin is still the % of the container that the element is in
Guil Hernandez
Treehouse TeacherGraham Davidson - Yep, it's relative to the parent element. I also recommend % based values for both margins and padding, as James Barnett mentioned.
Graham Davidson
Courses Plus Student 14,966 Pointscool thanks all
G