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

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

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.

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

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

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

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.