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 trialBen Witkins
469 PointsHow 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
10,158 PointsHi 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
Luke Glazebrook
13,564 PointsHey 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!
Tanya Luthera
473 Pointsjijioijijijijijijijijijiiiiiiiiiijjjjjjjjjjjiiiiiiiiiiijjjjjjjjjjiiiiiiiiijjjjjjjiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjiiiiiiiiiiijjjjjjjjjjiiiiiiiiiijjjjjjjjjjjjiiiiiiiiiijjjjjjjjjjjjiiiiiiiiiijjjjjjjjjjiiiiiiiiiijjjjjjjjjjiiiiiiiiijjjjjjjjjiiiiiiiiiijjjjjjjjiiiiiiiiijjjjjjjjjiiiiiiijjjjjjjjjjjjiiiiiiiiiiijjjjjjjiiiiiiiiiijjjjjjjjjjjiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjiiiiiiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
A X
12,842 PointsWhat the heck is this mess? :(
idan ben yair
10,288 PointsHi 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;
}
Ben Witkins
469 PointsThanks a lot, guys! Much appreciated. That did the trick.
Luke Glazebrook
13,564 PointsNo problem! I'm glad you managed to get it working.
Tanya Luthera
473 Pointsu suxk
idan ben yair
10,288 PointsGood 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
10,158 PointsUgh, I'm such an idiot! Thanks very much for that, was clearly getting myself confused.
Thanks!
Luke Glazebrook
13,564 PointsNo problem! I'm glad you managed to get it working.
-Luke
Luke Glazebrook
13,564 PointsLuke Glazebrook
13,564 PointsHi 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: