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 I set the image to be a block element?

I am doing a Code Challenge but I am stuck on the question where it asks me to "select the image and set it to be a block element"

Any help is appreciated. Thanks!

-Ben

7 Answers

Clair Griffiths
Clair Griffiths
10,158 Points

Hi there

Can someone please explain why this didn't work when I tried to apply it to the profile-photo class instead?

I tried this:

      #profile-photo {
         display: block;
       }

Can I not apply it to a class, only to an element?

Many thanks in advance for your help

Hi Clair!

The # is used as an ID selector which is why the code above is not working out for you. The following code should work, however:

.profile-photo {
    display: block;
}

Hey Ben!

The CSS you will need is as follows:

img {
    display: block;
}

Please note that the CSS selector may be slightly different than the one I have used in my example! Best of luck with the rest of your site!

jijioijijijijijijijijijiiiiiiiiiijjjjjjjjjjjiiiiiiiiiiijjjjjjjjjjiiiiiiiiijjjjjjjiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjiiiiiiiiiiijjjjjjjjjjiiiiiiiiiijjjjjjjjjjjjiiiiiiiiiijjjjjjjjjjjjiiiiiiiiiijjjjjjjjjjiiiiiiiiiijjjjjjjjjjiiiiiiiiijjjjjjjjjiiiiiiiiiijjjjjjjjiiiiiiiiijjjjjjjjjiiiiiiijjjjjjjjjjjjiiiiiiiiiiijjjjjjjiiiiiiiiiijjjjjjjjjjjiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj

What the heck is this mess? :(

idan ben yair
idan ben yair
10,288 Points

Hi Ben,

The challenge is referring to the option you have to display certain elements to appear in a block (meaning on top of each other) of next to each other:

you will need to apply it this way if you want the elements to appear on top of each other:

img {
 display: block;
}

Thanks a lot, guys! Much appreciated. That did the trick.

No problem! I'm glad you managed to get it working.

u suxk

idan ben yair
idan ben yair
10,288 Points

Good luck :)

And remember if someone helped you and you liked the answer you can upvote the answer or select as best answer, it will give your fellow students extra points :)

If you have any other questions please ask away! We will gladly answer you.

Clair Griffiths
Clair Griffiths
10,158 Points

Ugh, I'm such an idiot! Thanks very much for that, was clearly getting myself confused.

Thanks!

No problem! I'm glad you managed to get it working.

-Luke