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 trialAndrei Punei
14,051 PointsBefore and after space
What happens to the before and after space of the block elements? Can you get rid of them? Or are they part of the box element as the margin property?
2 Answers
Steven Parker
231,236 PointsIf you're talking about the space a pseudo-element might take ("div::before
or div::after
), this space is only allocated when you actually use the pseudo elements. Otherwise, no space is taken.
Andrei Punei
14,051 PointsDOn't block level elements take some space before and after by default?
Steven Parker
231,236 PointsThat would be the margins. Some elements (not all) have default margins but you can explicitly set them to 0.