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 trialt y
362 PointsLets say I want to target the lake image and the trees image for a red border. Can I give the selector 2 values?
Like:
img[src*="lake, trees"] { border-color: red; }
3 Answers
carlin aylsworth
5,650 PointsI believe the only way to select different elements based on different attribute values is as follows:
img[src*="lake"], img[src*="trees"] { border-color: red; }
Hope that helps!
Silvia Ramos
Front End Web Development Techdegree Graduate 18,318 PointsThank you for the QUESTION and the ANSWER, I was wondering the same thing :))))
Mixich Alexandru
2,994 PointsYou could give both images the same class and the change the border color using CSS.Ex:
<img scr="lake" class="img">
<img src="trees" class="img">
.img {
border-color: solid red;
}
t y
362 PointsThanks for your advice, but this course was about styling elements without using id's / classes. So I was curious if you can do this without using a class.
t y
362 Pointst y
362 PointsThanks for the reply, I will try it :)
ywang04
6,762 Pointsywang04
6,762 PointsIt works. Thanks a lot. :)