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
Caleb Pyle
501 PointsLosing a picture when adding a div
I added a div around a picture and it is removing the picture from my site.
For instance, before I add the div I have:
<img src="img/picture-of-me.gif" alt="Picture of Me">
Picture appears on the site!
Then I do the following
<div class="grid_3">
<img src="img/picture-of-me.gif" alt="Picture of Me">
</div>
Then the picture is no longer on the site.
Any ideas?
14 Answers
Amit Bijlani
Treehouse Guest TeacherHave you checked what the styles for the class grid_3? Can you post it here?
Caleb Pyle
501 PointsThanks for the response!
I suppose that is my confusion. I'm only in the beginner stages of these courses and I am using the grid.css download from one of the beginner courses in css.
Guil Hernandez
Treehouse TeacherHi Caleb,
It sounds like there's a rule somewhere in your CSS that is hiding the image in grid_3. Like Amit said, have you inspected all CSS properties for grid_3 and any img elements? If you're still having issues, please post your code on http://codepen.io/ and post the link here so we can take a look at it. Thanks!
Caleb Pyle
501 PointsThanks again! I hope this helps:
Caroline Hagan
12,612 PointsCaleb, that codepen only shows your HTML; we'd need to see your CSS as well.
Do you have a live link to the website you are working on?
Edit : you also have a few div's with missing closing brackets...
>
Caleb Pyle
501 PointsI see that, Caroline! Thank you!
Actually, that has corrected all of my issues so far. I'm embarrassed, but this forum has been awesome so far! Thank you so much for all your help!
Kris Jolls
5,157 PointsHaha. Don't be embarrassed. Took me hours the other night just to figure out I was missing a closing div tag. It's good to see we can get the help we need here and can receive the help nicely. Team treehouse for the win!
Caleb Pyle
501 PointsThanks, Kris!
OK, so here's where I'm at. Trying to stylize my site and with my css, I'm not getting any of the color added. Any ideas?
Kris Jolls
5,157 PointsLooks like you just need to apply a selector to your styles at the top. If you want the paragraphs to be styled use the p { selector like you did for the a { selector.
Caroline Hagan
12,612 PointsOr apply it to your body tag, like so...
body {
font-family: 'Nunito', sans-serif; color: #FAF3BC; background: #420600 url('img/bg-texture.jpg') repeat;
}
Caleb Pyle
501 PointsCaroline, that worked! I'm wondering why this worked and not the way I had it? Is there a significant difference I am missing?
Caroline Hagan
12,612 Pointsyou haven't told the CSS what you are applying the styles to ... unless it just got cut-off when you copied+pasted into Codepen? :-/
Jeremy Jantz
6,717 PointsCaleb, the initial styles in your css weren't attached to any specific element on the page. Caroline's suggestion of adding those to the body tag tells the browser what to attach those styles to...the body of the page.
Caleb Pyle
501 PointsThanks guys! This absolutely makes sense.