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 trialCallen Bracken
2,519 Pointshow do you set an image to be block element
please help.
3 Answers
myackley35
34,574 PointsHi Callen!
Images should be block level elements by default, however, if you want to make sure they are block level you can do something like this:
img {
display: block;
}
I hope this helps!
dnogmdehbp
Courses Plus Student 726 PointsFirst thing is why do you want to be your images be "block", maybe it's better to make a div or unorderd list where the image is in "block" ?
What Mark says is fine, but is for all your images,
<div class="imageholder">
<img src="path/to/image/" alt="description" title="other description">
</div>
and then in your css
.imageholder{
display:block;
}
Pav Cieslak
808 PointsI do agree with Robert as well that u could have either a wrap or container around your image. U could also asign a specific class to specific images u want to be displayed as block elements.
All of it depends from complexity of the project you are working on really, if its a small one pager, i would go with specific classes as it probably would save me code on my index file.
Its all up to you man which technique do u prefer.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi Mark,
Images are inline by default.
myackley35
34,574 Pointsmyackley35
34,574 PointsYou're correct, Jason. It should be inline. My mistake.