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

CSS CSS Foundations Selectors Basic Attribute Selectors

Jacob Israeli
PLUS
Jacob Israeli
Courses Plus Student 3,702 Points

why am i have trouble with attribute selector?

shouldn't this work? a[input="text}{background-color: lightyellow} --- these errors give me nothing to go on.

3 Answers

mrx3
mrx3
8,742 Points

not sure if this is correct, but try

a[input="text"]{background-color:lightyellow;}

It looks like you have a } instead of a ] at the end of the text part and you need a ; at the end of lightyellow Hope this helps and works out.

Jacob Israeli
PLUS
Jacob Israeli
Courses Plus Student 3,702 Points

no no this is exactly what i had.... the typo i had here did not appear in my code...

mrx3
mrx3
8,742 Points

Sorry Jacob I'm not sure then. Wish I could've helped out better. Looks like Jimmy got it though. Good luck.

Jimmy Hsu
Jimmy Hsu
6,511 Points

What are you trying to style?

I don't believe anchor tags have an input attribute to select from. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

Jimmy Hsu
Jimmy Hsu
6,511 Points

Looking further into the related code challenge, I've noticed you've gotten it wrong.

Look back into how the selectors work. Currently, with

a[input="text"]{background-color:lightyellow;}

it is invalid as there is no 'a[input="text"]'

Input is not a valid attribute, however type is.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input

You are selecting an input, with a type equal to text. You should be able to figure it out from here.