carstorm
carstorm

Reputation: 141

In CSS how do I affect links of only 1 class

I have a CSS and it displays fine however I want .bottom and .navt to have a link color of white and to remain white even after someone visits them. Here is my current code:

.toper{
border:1px solid black;
background:blue;
width:500;
height:90;
position:absolute;
top:0px;
left:50px;


}
.navt{
border:1px solid black;
background:darkblue;
width:1000px;
height:55px;
padding:10px;
position:absolute;
top:95px;
left:50px;
}


.bottom {
align:bottom;
border:1px solid black;
background:darkblue;
width:1000px;
height:55px;
padding:10px;
position:absolute;
bottom:5px;
left:50px;

}

body{
background:lightblue
}

How would I do this by just using this sheet. (I don't want to use more divs and other stuff because that would involve editing many pages whereas doing something to this page changes them all.

Upvotes: 0

Views: 346

Answers (3)

Angad
Angad

Reputation: 2823

.bottom a, .navt a {
    color: #fff;
}

This works as so:

Any <a> tag in class bottom and navt, should have a foreground color of RGB Hex #fff

Don't worry about hover or visited yet. Unless these properties are defined, you're browser won't assume them, since you have specifically overridden assumed value for a itself.

Upvotes: 0

Nightfirecat
Nightfirecat

Reputation: 11610

You could target them like so:

.bottom a:link, .bottom a:visited, .navt a:link, .navt a:visited{
    color: white;
}

Upvotes: 0

Domenic
Domenic

Reputation: 112817

.bottom a, .navt a, .bottom a:visited, .navt a:visited {
    color: white;
}

Any link contained in elements with class bottom or navt, either visited and unvisited, will now be white.

Upvotes: 2

Related Questions