CSS CSS Selectors Going Further with Attribute Selectors and Pseudo-Classes Substring Matching Attribute Selectors Challenge

I need help with a target selector?

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

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

img[src*="product"] {
border-color: lightblue;
}
Shaun Earley
Shaun Earley
20,239 Points

You are trying to target the src or source of your image. The src should point to your image file in your HTML. Try replacing "src" with "title" if you are trying to find images with the title = product.

hope this helps Shaun

Thank you Steven but your answer is not working I have tried it exactly as the video indicated and without the dash and the dot. See my third post it has the exact way I have been putting this in.

Steven Parker
Steven Parker
207,602 Points

The challenges will never be something you can solve by pasting in the same code from the video follow-along. They may be similar but some part of it will be different. It's important to follow the instructions as given in the challenge.

I've been pointing out the specific things that need to be fixed to fit what the instructions are asking for (and to pass the challenge). You have re-asked this same question, but each time you still have not fixed the items I already pointed out.

1 Answer

Steven Parker
Steven Parker
207,602 Points

Here's a few hints:

  • the instructions say "title" but the attribute named here is "src"
  • the instructions say "begins with" but the symbol used here means "contains"
  • the instructions say "product-" but the string here is "product" (missing the "-" symbol)