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 trialAnusha Singh
Courses Plus Student 22,106 PointsCreate a selector that targets an img element if its title value begins with "product-". Set the border color to lightbl
Create a selector that targets an img element if its title value begins with "product-". Set the border color to lightblue. I had put in a code
img[src*=" product-"]{ border colour: lightblue; }
however it is giving an error continuously.
/* Complete the challenge by writing CSS below */
img[src*="product-"] {
border-color: lightblue;
}
1 Answer
Jennifer Nordell
Treehouse TeacherYou're very close here! The challenge asks you to select the images that contain title that begins with product- . Your code selects images that have product- anywhere in the source attribute. Note the title and the src are two different things. And again that * means that it'll pick it if "product-" is anywhere in there. Not just if it begins with "product-". Take a look at what they're looking for.
img[title^="product-"] {
border-color: lightblue;
}
We use the ^ to indicate something that starts with that string.