Click to See Complete Forum and Search --> : apply a style for all links except one
pontonet
04-20-2007, 11:49 AM
hi everybody...
i`m applying a style for all my links (ie: a { [...] }). ok, but i want that one link in particular doesn`t get that style.
is there any way to accomplish tht without setting a class for all my page links?
any hint would be much appreciated... :]
TheBearMay
04-20-2007, 12:01 PM
How about just setting a different class on the one you don't want styled...
ryanbutler
04-20-2007, 12:13 PM
In addition to what was replied, this is probably what you want:
All links that you want the same:
a:link
a:visited
a:hover
a:active
The one special link:
a.special:link
a.special:visited
a.special:hover
a.special:active
HTML:
<a href="somepage.html" class="special">Click me</a>
bubbisthedog
04-20-2007, 01:16 PM
Following is a very simplistic example, but shows you another way to exclude an element. It uses the CSS child selector to say, 'anything that is a direct child of the body element will receive this style, and nothing else.' For an a tag, this is a valid approach since the a tag is inline; if a was a block-level element, it would not be valid XHTML 1.0 Strict.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>hello hello hello hello hello</title>
<style>
body > a
{
color:red;
}
</style>
</head>
<body>
<a>hello</a>
<a>hello</a>
<span id="no_class">
<a>hello</a>
</span>
<a>hello</a>
<a>hello</a>
</body>
</html>
NOTE: This does not work in IE7 quirks mode. The DOCTYPE is required. Have not tested with DOCTYPES other than XHTML 1.0 Strict.