Styling Links Inside a Div with a Specific Class

styling links inside a div with a specific class

.navigation-div a:link, .navigation-div a:visited {
color:red;
}

jsFiddle example

Changing a link-style, only for a certain class

Maybe your tested links are visited links.
I prefer:

#navbar a:hover,
#navbar a:visited
{
background-color: #3366FF;
}

apply CSS to links inside DIV

You should have a look at Combinators in CSS.

If you want the exact style of .headband to apply for <a> elements inside .headband too, then use

.headband, .headband a {
/* ... */
}

Otherwise, just create a new section like

.headband a {
/* ... */
}

How to change a:link and a:hover for a div alone?

In CSS:

div.classname a:link {
color: #123456;
}

div.classname a:hover {
color: #123;
}

div.classname a:visited {
color: #654321;
}

In HTML:

<div class="classname">
<a href="#link">link</a>
</div>


Related Topics



Leave a reply



Submit