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
John Sanchez
3,325 PointsCSS Images
I may be missing something extremely simple, but why can images be given a width and a height when they are inline elements? I thought this only worked for block elements like divs.
Thanks, John
1 Answer
Greg Kaleka
39,021 PointsHi John,
Inline vs block just determines where the element is with relation to the stuff around it. Divs can be displayed inline and images can be displayed as block elements.
Here's a quick refresher on inline vs block display.
Best,
Greg
John Sanchez
3,325 PointsJohn Sanchez
3,325 PointsThanks Greg!
The link above says that inline elements "Will ignore the width and height properties".
Shouldn't images do the same?
John
John Sanchez
3,325 PointsJohn Sanchez
3,325 PointsNevermind, I spoke too soon. I understand now. Thanks so much!
John