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

Ivelina Ventsislavova Stoilova
Ivelina Ventsislavova Stoilova
4,984 Points

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

My code is wrong- any ideas what is the issue?

style.css
/* Complete the challenge by writing CSS below */
A [img='product-'] {

  border-color: lightblue;
}

3 Answers

Conor Vanoystaeyen
Conor Vanoystaeyen
16,666 Points

I think is more in the line of

img[title='...'] {
    ...: ...;
}

Bet css is not my best subject.

Steven Parker
Steven Parker
182,024 Points

The instructions say, Create a selector that targets an img element if its title value begins with "product-".

But the code shown here:

  • requires an "A" element container
  • does not specifically target "img" elements
  • looks for an "img" property instead of "title"
  • checks for an exact match instead of a "begins with"
Dane Andrade
Dane Andrade
7,942 Points

/* Complete the challenge by writing CSS below */

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

[attr^=value] Represents elements with an attribute name of attr whose value is prefixed (preceded) by value.