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

attribute selector giving error

a[class="check"] { color:darkred; }

input[class="text"] { background-color:lightyellow; } ----------------------------------------------------this is giving error though it looks ok to me

<!DOCTYPE html>
    <title>Attribute Selectors</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus sed egestas tortor, vel tincidunt dolor.
    <a href="#" class="check" title="More!">Duis ut velit faucibus</a>
        Proin orci arcu, dapibus vel faucibus in, commodo in nunc. <a href="#" class="check">Vestibulum erat dolor laoreet</a> nec cursus non, luctus ut elit. In sed congue lectus, id ullamcorper massa. <a href="#" title="More!">View more &raquo;</a>
        <input type="text" name="email">
        <input type="submit" name="submit">
/* Complete the challenge by writing CSS below */



4 Answers

Tobias Helmrich
Tobias Helmrich
31,602 Points

Hey Chetan,

just to make sure: Are you talking about the first task? If so, you have to select all anchor elements that have a title attribute which you do like so:

/* Complete the challenge by writing CSS below */
a[title] {
  color: darkred;

second one for text is not correct as per question and answer though it looks ok to me

Tobias Helmrich
Tobias Helmrich
31,602 Points

Hey again Chetan,

for the second one you have to select all inputs with a type attribute set to text. You're however selecting inputs with the class of text.

That should work:

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

oops i got it , thanks for the reply