Applies to unvisited links ('A' tag with specified href attribute).
<head><style>a:link { color: red; }
a:visited { color: black; }
a:active { color: green; }
a:link:hover {
background-color: #f3f2e7;
color:#8a4500;
}
</style></head><body>
Click on the following hyperlinks to see the default, normal and visited states:
<br/><br/><ahref="#first">Hyperlink text</a><br/><br/><ahref="#second">Hyperlink text</a><br/><br/><ahref="#third">Hyperlink text</a></body>
Applies to visited links ('A' tag with specified 'href' attribute, that has been visited by the user before).
<head><style>a:link { color: red; }
a:visited { color: black; }
a:active { color: green; }
a:link:hover {
background-color: #f3f2e7;
color:#8a4500;
}
</style></head><body>
Click on the following hyperlinks to see the default, normal and visited states:
<br/><br/><ahref="#first">Hyperlink text</a><br/><br/><ahref="#second">Hyperlink text</a><br/><br/><ahref="#third">Hyperlink text</a></body>
Applies to the element which is the target of the current document's URI.
In other words, if the current document's URI ends with a fragment identifier (#something), the :target pseudo sets style rules for the a element with name attribute of 'something'.
Applies to the currently engaged or active element within the document.
The active pseudo class works differently in different browsers, in Internet Explorer earlier than version 8 it affects link elements only, in Firefox, Opera, Safari, Google Chrome and in Internet Explorer from version 8 it affects all elements that can have focus (input, button, a,...).
<head><style>a:active {
color:red;
}
</style></head><body><ahref="#linktarget">Click to activate</a><br/><aname="linktarget">the target link</a></body>
Note: The :default pseudo is supported in Firefox from version 3.
For example a submit button is a default user interface element on a form, when the user presses enter while editing the form, the default button is pressed.
If more than one submit button is placed on a form, only the first submit button is the default button.
Applies to elements with the specified language setting. The code parameter must contain a specific language code
that identifies the language that the rules applies to.
Note: The :lang pseudo is supported in Internet Explorer from version 8.
Used to negate a normal selector.
Available values of selector :
tag selector
A specific tag name, such as "'span', 'div' ... . This selects all elements except the given elements.
class selector
A single class name or a comma-separated list of class names. This selects all elements that do not have the given class or classes.
property value pair selector
Property with the given value, for example [type="text"]. This selects all elements that do not have the given property value pair.
This selects all div elements that do not have the class .red.
<head><style>div:not(.red) {
color:green;
}
.red {
color:red;
}
</style></head><body><div>
Not red div (must be green).
</div><divclass="red">
A red div.
</div></body>