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 trialpamela guy
Courses Plus Student 4,311 Pointsif my text is white and i want to hover over the text and make it blue how would i do that?
In this case it is in a nav: nav a nav a:hover{ color: #fff color: #678987 }
not working to i have to put a:visited or a:selected?
a {
text-decoration: none;
}
#wrapper {
max-width: 940px;
margin: 0 auto;
}
#logo {
text-align: center;
margin: 0;
}
h1, h2 {
color: #fff;
}
p {
color: #000000;
}
nav a nav a:hover a:visited{
color: #fff;
color: #32673f;
}
2 Answers
Steven Parker
231,236 PointsYour CSS selector is invalid.
Try this simpler one instead:
nav a:hover {
color: blue;
}
Just to be clear: this will not affect any text other than links ("a" elements) that are inside a nav
element. If you want this to apply to other text, you'll need an appropriate selector for that text. For example, if you wanted to make any paragraph turn blue when you hover on it:
p:hover {
color: blue;
}
Hadi Khalili
7,969 PointsYou need to use two rules to accomplish what you want to do. Here is how: first rule declares the color of nav a text when nothing is happening.
nav a {
color: #fff;
}
Then the hover color
nav a:hover{
color: blue;
}
Note: if you want to use one rule for hover and visited because they share the same color, you need to use comma to separate selectors. Comma is not need when you want to select an element nested inside the parent element.
nav a:hover, nav a:visited {
color: blue;
}
Good Luck
Bartlomiej Figatowski
5,843 PointsBartlomiej Figatowski
5,843 Pointslogo h1:hover{
color: #678987;
} or logo h2:hover{
color: #678987; }
It should work.