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 trialAndrew Fu
1,477 PointsNot sure why task1 breaks when I add this code
@media screen and (max-width:705px) {
.grid_1,
.grid_2,
.grid_3,
.grid_4,
.grid_5,
.grid_6 {
width: 100%;
}
/* I add this piece of code in, and task 1 above breaks */
#intro {
display: none;
}
}
2 Answers
Dave McFarland
Treehouse TeacherYou're hiding the entire intro <div>
tag, not just the image. You need to use an attribute selector to pick up just the image. Here's one way:
img[alt="Love at First Bite"] {
display: none;
}
This will also work:
img[src$="love-at-first-bite.gif"] {
display: none;
}
Andrew Fu
1,477 PointsSo, is it the case where as long as you have multiple different alt's, it hides based on them? ex:
img[alt="Love"] {
display:none;
}
img[alt="Hate"] {
display:none;
}
In this case, do both hide different images with the alt descriptions?
Dave McFarland
Treehouse Teachercorrect. img[alt="Hate"]
will only match an image that has the alt attribute of hate. So in the code below, it will only match the first image
<img src="a.gif" alt="hate">
<img src="b.gif" alt="love">
Dave McFarland
Treehouse TeacherDave McFarland
Treehouse TeacherHi Andrew,
Your HTML code wasn't showing up correctly. I fixed it in your post.
For the future, to put HTML/CSS/JavaScript in a forum post:
hit return to create a new line and type three back tick characters ```
hit return to create another new line and paste your HTML
hit return and add three more back tick characters: ``` The back tick character isn't the same as the single quote -- ' -- mark; the back tick is located on the same key as the ~ on most keyboards.
Also to add correct color highlighting add the name of the language after the back ticks like this: ```CSS. Here's what CSS should look like in a forum post: