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 CSS Selectors Going Further with Attribute Selectors and Pseudo-Classes Substring Matching Attribute Selectors - "Begins With" and "Ends With"

Angel Vickery
Angel Vickery
3,585 Points

my images will not pop up.

what am i doing wrong. i copied their code to the t and i still can not figure out why my pdf, jpeg, and .zip file images are not showing up.

Angel Vickery
Angel Vickery
3,585 Points

*** This is my code***

/* Substring Matching Attribute Selectors ---- */

a[href^="http:"] { color: #52bab3; text-decoration: none; background-repeat: no-repeat; background-size: 18px 18px; padding-left: 25px; }

a[href$=" .pdf"] { background-image: url('../img/icn-pdf.svg'); }

a [href$=" .jpg"] { background-image: url('../img/icn-picture.svg'); }

a [href$=" .zip"] { background-image: url('../img/icn-zip.svg'); }

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! While Kevin Korte is correct and you should definitely check out your file structure, I would also point out that in every case where you have href in the code you posted above, you also have an extraneous space before the file extension. This could be causing problems. For instance you posted:

a[href$=" .pdf"] 

Try changing it to:

a[href$=".pdf"]

I believe it might believe that the file should contain a space before the extension otherwise. Let me know if this helps! :sparkles:

Angel Vickery
Angel Vickery
3,585 Points

Jennifer Nordell, Thank you so much! all that was wrong was spacing.

Kevin Korte
Kevin Korte
28,148 Points

Hey Angel,

The most common problem is the file path to the image isn't correct, it happens to everyone. Make sure your files are where you're telling the computer they are.

What you're file path is saying, is from wherever this file is, go up one folder ( that's the ../ ), and then look for an img folder, then in there, look for these files.

Which means you must have a folder structure similar to

  • --css
  • ----style.css
  • --img
  • ----icn-pdf.svg
  • ----icn-picture.svg
  • ----icn-zip.svg