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!

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 Basics (2014) The Box Model Display Values

Prince Karikari
Prince Karikari
Front End Web Development Techdegree Student 157 Points

Display inline

Guil said that top and bottom margins dont affect elements with the display value INLINE. But, the top and bottom margin property works with IMG elements even though their display value is INLINE. Any reason for that?

1 Answer

<img> tags are both. They are referred to as replaced inline element

Unless you float an <img> tag it will flow with the tet that is around it.

However, it still has properties like a block element such as width and height so it acts like it is inline-block

Hope that helps