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
John Levy
1,451 PointsAll the elements change when I use the a. attribute
When I added a option menu (stating on line 18 in my CSS) it affected the rest of my code. I think it is due to the a. attribute but I dont know what I should do if I have two separate a. attributes. For example one starts on line 92 which is for the option menu but then I have another on line 253 which is for the drop down menu. When I add both these codes together the a. attributes from line 18 affects the rest of the elements How do I separate them so the new option menu on lines 22-137 does not affect the other elements? It is for the mobile screen so the max-width is 600px. I have attached my code below http://codepen.io/Johned22/pen/JRAyNE Thanks in advance
4 Answers
Gerardo Blanco
13,223 PointsYou should try to specify more
css #menu.a {...}
You can be more specific by telling the parent id or class and then the element. With this you will only target the <a> that are inside the id menu.
Also you can put a class to the link you want to change
html <div id="menu">
<a href="ebookmensbeginnermobile.html" class="aBlue">BEGINNER</a>
<a href="ebooksmensadvancedmobile.html" class="aBlue">ADVANCED</a>
<a href="ebooksmensbundlemobile.html" class="aBlue">BUNDLE</a>
</div>
css .aBlue {...}
Css uses "." to target classes and "#" to target id.
Glad i can help
John Levy
1,451 PointsThanks, that solved my issues
Gerardo Blanco
13,223 PointsTheres multiple ways to fix this, it all depends how you are targeting / selecting each element.
You should look in to this course to have a better grasp on the css selectors.
(https://teamtreehouse.com/library/css-selectors)
If you need more help it would be easier if you can tell us what part of your html you whant for each css rule
John Levy
1,451 PointsThanks for your response. The problems arose when I added the option menu. This is on lines 24-28 in the HTML and lines 17-136 in the CSS. Since I added this it has caused some of the other elements to become blue or change shape which it should not. What would be the best way of fixing these issues? I only want the new option menu to be edited as the rest was working fine before I added the new option menu. Thanks