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 trialhoppy bouasavanh
Courses Plus Student 1,791 Pointswhy do we set display of img as "block"?
?
1 Answer
Obey Mabaso
9,803 PointsHi Hoppy
Personally think its a matter of choice. There are many other options. You wouldnt want to display an image as "inline"
TRY these other options and you will appreciate the use of display property:
display: none display: inline display: block display: contents display: list-item display: inline-block display: inline-table display: table display: flex display: inline-flex display: grid display: inline-grid
jasonjones5
Courses Plus Student 5,571 Pointsjasonjones5
Courses Plus Student 5,571 PointsEssentially an inline element only occupies the space of it's bounding tags and can't be changed. A number of tags are inline by default and generally relate to text content. Block elements can be configured independently of content i.e you can make a div the full size of a page but only fill it with one word and it would still work. If you put an image in an inline element you would only see a small part of it by default if it worked at all.