Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.