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

Peter Kim
Peter Kim
3,896 Points

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

Please help!

style.css
/* Complete the challenge by writing CSS below */

11 Answers

rydavim
rydavim
18,814 Points

You need to select certain images using the attribute selector syntax element[attribute^="value"]. Note that the ^= means starts with. If you need to look up how to select using other filters try this w3schools page.

The rest of the challenge questions will likely be similar, so here's an example to get you started...

img[title^="product-"] {
  border-color: lightblue;
}
Dominic Cyr
Dominic Cyr
1,765 Points

If you're stuck, here is my advice: do not insert a space after your img element. You may save many minutes reminding that! :-)

ahhhhhhh that's it

low-key

img[title^="product-"]{ border-color:lightblue; }

ah ok this is a duplicate of your other question....answered it over there

Hi Peter,

Would love to help if I can. What's the problem you are having?

Andres Ramirez
Andres Ramirez
18,094 Points

I've been building HTML/CSS websites for over 3 years, and never knew about this type of selectors...

They are AWESOME! Such a great lesson :)

Roberto Da Silva
Roberto Da Silva
4,213 Points

I'm having the same issue, can anyone help ? /* Complete the challenge by writing CSS below */

img[title^="product-"] { border-color: lightblue; }

a[href*="html"]{ text-decoration:none; }

Roberto Da Silva
Roberto Da Silva
4,213 Points

I have changed the character which should be $ but still doesn't work =/

Andres Ramirez
Andres Ramirez
18,094 Points

img[title^="product-"] { border-color: lightblue; }

hi

img[title^="product-"] { border-color:lightblue; } what is wrong with my code