Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,780 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,093 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,093 Points

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

hi

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