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

CSS CSS Layout Techniques Display Modes Block vs. Inline Elements

Mark Lawson
Mark Lawson
6,148 Points

display: inline

He touches on the subject of display: inline and the fact you cannot add width of top and bottom margin to the items. Whats going on here? Why can you not apply these styles to inline styles?

Thanks

2 Answers

I think it is because a inline element flows with the other content on the page and it can't break out of the normal document flow. Because of that you can't apply a style that forces a change in this flow, like margin-top and margin-bottom.

Cindy Lea
PLUS
Cindy Lea
Courses Plus Student 6,497 Points

From what Im reading, if you use margins with inline elements, it will have no effect.

one site: This property has no effect on non-replaced inline elements, like <tt> or <span>.