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
mrx3
8,742 PointsHaving some trouble with styling my a href links.
In my navigation I have two a href links, one is for about, and the other is for contact. In my div main-content section I have two a href links that link to two pictures. The a href links that are in the navigation are interfering with my links in the pictures. When I hover over the links for my pictures they disappear. For instance when I hover over the links under my pictures the links disappear and the background of the pictures has a lime green border radius that peaks through. I have added my code pen below. If you hover over the works "Spain at dusk" and "Spain sunrise" You'll be able to see what I'm talking about. What I've thought about doing is Because the href ends with .jpg. But I'm not sure how to write the CSS to do it. Thanks in advance for any help. Code Pen below. http://codepen.io/mike316/pen/KyHxi
a[href$="jpg"]
2 Answers
Shaun Dixon
10,944 PointsWhen you are styling your links, you have not specified which element you want to style. By using the following code:
a:hover { color: #FFFFFF; background: #00FF00; }
You are telling the page to use the hover colour green on any links on the page. If you just want to apply this hover to your navigation you could use:
.nav a:hover { color: #FFFFFF; background: #00FF00; }
By using the .nav before the a:hover you are telling the page to only apply that style to the navigation and not your images.
Shaun Dixon
10,944 PointsYour welcome :) It happens to all of us especially when you have been looking at the screen for a very long time trying to figure out whats wrong. Don't be embarrassed its all part of learning :D
mrx3
8,742 PointsThanks for the kind words Shaun, you deserve the 10 points for the best answer.
mrx3
8,742 Pointsmrx3
8,742 PointsOh goodness, I can't believe I missed that. I been practicing and practicing and practicing. My mind is working, and seeing nothing but HTML and CSS. Thank you so much Shaun for your help. I'm rather embarrassed about this.