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 for an anchor under an ID is affecting all anchors in page.

The attributes in this ID are affecting all anchor elements on my page. How do I make sure they only change the anchors in the #selection?

selection, a {

background-color: #d6d6d6;
padding: 8px;
border-radius: 5px;
border-style: solid;
border-width: thin;
border-color: #555;
color: #555;
text-decoration: none;
font-weight: 800;

}

1 Answer

Hi Derek! You have your syntax wrong if you want to target an ID at css do the following:

  #selection {
    /*styling here*/
  }

Cheers!

Edit (comment added to final answer):

I noticed that selection , a was left out from your code formatting so maybe you are targeting it right , thats being the case you should remove the coma between selection and a tag and it should work fine :)! Comas are there to separate tags you are selecting!

Thanks. I'll take out the comma. Good catch.