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 trialmfod
1,708 PointsIs there a container holding the images? How was there extra space beneath the image to create a background color?
Every image has a gray background right below the image.
2 Answers
Craig Watson
27,930 PointsHi Mariam,
As Jonathan has pointed out, the "li" element is wrapping more than one child element as you can see from the small code snippet below from that course.
<li>
<a href="img/numbers-06.jpg">
<img src="img/numbers-06.jpg" alt="This is an image of blending modes used in Photoshop">
<p>Playing with blending modes in Photoshop</p>
</a>
</li>
So your situation here is that if you have the "li" set with a background color, this will in turn be the background color for any child elements because by default an element has no, or shall we say a transparent background unless or until you provide those child elements with a background color independently.
So... using the code above here is some CSS that might help a little more to explain.
// Using this on its own will make the background of the li, a, img, and p all the specified color.
li {
background: #f5f5f5;
}
// If you then give the p tag a background this will independently change the p tags background and if there is any space above of below the p tag for example from some margins, then you would see the background color of the li come through.
li {
background: #f5f5f5;
}
li a p {
background: #ff00ff;
}
I have thrown this together so you can have a play around with the code quickly to see what happens and maybe help gain a better understanding. Link
Hope this helps Craig
Jonathan Walz
21,429 PointsYes, if you look in the index.html file, notice that line 28 has an 'li' tag. Both the image and the text are inside this list item element. This list item element has styling in the main.css file on line 90 to create a darker background.