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

HTML How to Make a Website Adding Pages to a Website Make an About Page

How do you select the image and set it to be a block element?

I've tried to select the image in the css file and do a 'display: block;' But that doesn't seem to work.

huckleberry
huckleberry
14,636 Points

Setting an img tag to block should work as you mentioned. Could you show your code exactly as you have it? (both html and css please.)

Thanks

Cheers,

Huck - :sunglasses:

Julie Myers
Julie Myers
7,627 Points

Make sure it looks like this:

img {
  display: block;
}

If you already have the above, then it could be you may have forgotten to link your css file in your html file. Or there is a spelling or syntax error in your link element.

3 Answers

What if you use the img's class name instead of "img" on your main css file?

Angela Visnesky
Angela Visnesky
20,927 Points
section img {
display: block;
}

Hmmmmm..... I've tried both of these and they don't seem to work.