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 trialKim Gee
3,841 PointsExplain
This is a Code Challenge: Create a selector that targets an img element if its title value begins with "product-". Set the border color to lightblue. what do they mean by title????? I have this code that is wrong a[title^="product"] { border-color: lightblue; }
/* Complete the challenge by writing CSS below */
a[title^="product"] {
border-color: lightblue;
}
7 Answers
Kevin Korte
28,149 PointsYour selector is picking an anchor element but you mentioned in your text that the element it wants you to select is an image.
codyzclimer
17,481 PointsI think you are targeting the wrong element there it should be 'img' instead of 'a'. also want to make sure you get the string right. Hope this helps :]
/* Complete the challenge by writing CSS below */
img[title^="product-"] {
border-color: lightblue;
}
Kim Gee
3,841 PointsNeither anchor or image is accepted as the correct answer.
img[title^="product"] {
border-color: lightblue;
}
Kevin Korte
28,149 PointsI went and looked at the question and noticed it asked to us the title attribute selector for an image that starts with product-
, you are only using product
and I bet that's why it won't pass.
Kim Gee
3,841 PointsDoes image have a title attribute? i don't see that it does. the ^ means for the browser to look at the image tag inside of a title attribute and the value of title should begin with product. But image does not have a title attribute? Is my thinking wrong?
Kevin Korte
28,149 PointsImages can have title attributes, yes. What it wants is a selector to for this HTML
<img src="path/to/img.jpg" title="product-101">
Kim Gee
3,841 Pointsthank you
Kim Gee
3,841 Pointsso embarrass left out the "-" after product!
Kevin Korte
28,149 PointsYou're welcome, and don't be embarrassed. Tiny oversights like this are super common even for most veteran of coders.