Forum Moderators: not2easy
I'm wanting to define a specific link color that differs from the "A: link" colors.
When I use a div like this:
div.nolink {
background: transparent;
color: #669999;
font: 11px verdana, arial, sans-serif;
text-align: center;
text-decoration: none;
margin: 6px;
}
.... the text-link centers but defaults to the "A: link" color.
When I add the "a" like this:
div.nolink a {
background: transparent;
color: #669999;
font: 11px verdana, arial, sans-serif;
text-align: center;
text-decoration: none;
margin: 6px;
}
..... the new link color shows, but I loose my center and margin.
Suggestions?
<div class="nolink><a href="someURL" class="linkcolor">Link Text</a></div>
div.nolink {
background: transparent;
color: #669999;
font: 11px verdana, arial, sans-serif;
text-align: center;
text-decoration: none;
margin: 6px;
}
.linkcolor a {
background: transparent;
color: #669999;
font: 11px verdana, arial, sans-serif;
text-align: center;
text-decoration: none;
margin: 6px;
}
even tried:
a.linkcolor {
background: transparent;
color: #669999;
font: 11px verdana, arial, sans-serif;
text-align: center;
text-decoration: none;
margin: 6px;
}
Basically, the mistake is to think it aligns the element. It doesn't; it aligns the text inside the element.
Consider the <div> element with some text inside it. It might look like this:
+--------------------------+
¦ ¦
¦This is some text ¦
¦ ¦
+--------------------------+
No consider an <a> element. It is an inline element, which means that the element is only as wide as it needs to be. It looks like this:
+--------------+
¦This is a link¦
+--------------+