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 trial

JavaScript Treehouse Club: JavaScript Car Sounds CSS Selectors

Gabriel Camacho
Gabriel Camacho
2,337 Points

Adding a stoke to the button elements

Hello.

I was playing around and i was trying to add to the key button a stroke to the right and to the nitro button a stroke to the left. How can i make the stroke specific to only that button?

i try it like this and other ways around but couldn't do it.

.src["images/key.png"] { border-right-style:dotted; border-right-color:Gray; border-right-width:thin; }

thanks!

1 Answer

Steven Parker
Steven Parker
231,275 Points

This is really a CSS issue, not a JavaScript issue.

Your CSS selector seems to be targeting an element with class src (which is not present in the HTML), and a property named "images/key.png" (which is probably not valid).

But it seems like you wanted to target the IMG tag that has the src property of "images/key.png". That would look like this: img[src="images/key.png"].

Putting it together for both buttons (and collapsing the CSS into the shorthand notation), you would get:

img[src="images/key.png"] { border-right: thin dotted Gray; }
img[src="images/nos.png"] { border-left: thin dotted Gray; }
Gabriel Camacho
Gabriel Camacho
2,337 Points

Thanks a lot! of course the selector should go to the img