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 Challenge

Steven Espin
Steven Espin
3,012 Points

targeting sub strings (code challenge)

not sure what is wrong with my code trying to target a image src starting with "product-".

this is the question: (code challenge)

Create a selector that targets an img element if its title value begins with "product-". Set the border color to lightblue.

img[src^="product-"] {
  background-color: lightblue;
}

this is the error i get:

Bummer! Are you using a selector that targets 'img' elements with a title value beginning with 'product-'?

Erik Cruz
Erik Cruz
9,772 Points

Can you post your code to see what the issue might be.

Steven Espin
Steven Espin
3,012 Points

i added the code and question asked

2 Answers

Hi Steven,

You're trying to match the src attribute but it should be the title attribute.

Also, it wants you to set the border-color, not the background-color

Steven Espin
Steven Espin
3,012 Points

got it to work. thanks, appreciate it.

SON VO
SON VO
6,165 Points

Hi Steven, The question is to add border-color not the background-color. U just need to change it to border-color and everything will be fine. Hope this helps!