Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.