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 trialDavid Regel
Full Stack JavaScript Techdegree Student 5,504 PointsWhat is the basis of our 18% and 24% padding we use in this course?
I know that the width of the container is the basis which our percent-value for padding is based on. Which element is the container that the padding-value is based on in this video? Is it the body-element? When we use 18% as the top and bottom value for our padding, why is there more space on top than at the bottom?
2 Answers
Steven Parker
231,236 PointsThe percentage values are still based on the parent (container) element. which in this case is the div
with class "primary-content".
Paragraphs (p) and headings {h2) both have margins that add to the padding, making it appear that the padding sizes are not equal (when they are).
You can examine this using the browser's developer tools, or you could add another container with a visible border just inside the one with the padding to show the content boundaries.
Kathya Sarria
945 PointsI did not quite understand the padding based on the width. What is the width of that div? Can you go further in this logic. Thanks!
Steven Parker
231,236 PointsIt's not unique to padding. Any percentage unit is relative to the width of the parent element.
Geovani Mejia
Front End Web Development Techdegree Student 7,940 PointsGeovani Mejia
Front End Web Development Techdegree Student 7,940 PointsIs the div "primary-content" the parent container because it is the first div after the tag <body> ? Thanks
Steven Parker
231,236 PointsSteven Parker
231,236 PointsIt's the parent element because it surrounds the element in question. It's placement in the body is just a coincidence.