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 trialOmar Zeidan
8,893 PointsContext of padding !
Hello ,
I am not sure , but is that correct that when we want to calculate a fluid -padding- the context will be its width ! not the parent width -if has parent - !!
Because margin use the parent width for sure as a context .
3 Answers
Guil Hernandez
Treehouse TeacherYou are correct, Omar.
The context for %
is the width of the content area.
The context for ems is the font-size of the element.
Keith Wyland
10,576 PointsOne way to think of this might be to consider the CSS box model.
Padding adds space inside the box, so it's context is within the box also.
Margin adds space around (or outside) the box, so the context is the next box up (parent).
Omar Zeidan
8,893 Points@guil Thank you so much for answering :)
@keithwyland Great idea to keep in mind , thank you ^_^