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

CSS

Media Qry: Forgot how to hide a pic??

I'm embarrassed to say that after all this learning, I can't remember how to hide a picture. I'm in the "Media Query" Code Challenge and I've done it before but I can't remember the syntax. I can show what I have so as to possibly get some hints at what's wrong. CSS ```img { "img/love-at-first-bite.gif" display: none; }

This is below the class "grid_2 omega" & this is all to go within my existing query of:

@media screen and (max-width: 705px) { .grid_1 {width: 100%}

This goes from "grid_1 through 6";
Any help is greatly appreciated.  Many thnks.

3 Answers

In CSS if hiding an HTML image you don't need to include the image name and location you can just use the img selector or to be more specific you can add a class/id to the image and use that selector. So for simplicity you could do

@media screen and (max-width:480px) { img { display: none; } }

Got it many thanks!!

Alessandro Lorizzo
Alessandro Lorizzo
10,667 Points

Hi, do you think it is useful to use attribute selector targeted on the image title?

I wouldn't target the image title is you mean the alt="" text. I would target the file name with

Img[src=""] { // styles here }