css| Web page
You may have realized that you can create a CSS rollover effect by specifying a different style for each key link, which includes normal link (normal), access, flip, and activate. And, you may also know that the order of CSS types can have an effect difference, and the style of the CSS code will replace the style of the previous order for the same element. It is important to establish the type Order of tumbling effects.
Now let's see how to schedule the type of link state to support normal rollover effects without conflict, and how to rearrange these type orders to get a different rollover effect.
Link state
A typical CSS rollover effect relies on a standalone type of one of the four states in the hyperlink. You can create a <a> (hyperlink) type that comes with a CSS pre-class to specify the link state:
a:link--General, non-access hyperlinks
a:visited--Access to hyperlinks
a:hover--the link when the visitor operates the mouse
a:active--Click on the link
In order to make a typical CSS rollover work, the CSS type Order in CSS code is important, whether it's an external type table or a type rule embedded in the HIML page title bar.
The
a:link type occurs as early as it can be applied to all links. The a:visited type is ranked second, and it replaces any linked a:link format. (If the A:link type follows the A:visited,a:link, the a:visited type may be substituted.) followed by the a:hover type, which is used only to access the link under the mouse. The last is a:active, so when the link is clicked, it can replace all other types.
a:link {
color: #0000FF;
Text-decoration:underline;
Font-weight:normal;
Font-style:normal;
}
a:visited {
color: #3399FF;
Text-decoration:underline;
Background-color: #FFFFFF;
Font-weight:normal;
font-style:italic;
}
A:hover {
color: #0000FF;
Text-decoration:underline;
Background-color: #FFFF00;
Font-weight:bold;
Font-style:normal;
}
a:active {
color: #FF0000;
Text-decoration:none;
Background-color: #CCCCCC;
Font-weight:bold;
Font-style:normal;
}
The type Order in CSS code determines how each type replaces other types, that is, that more types can be applied to a particular element. Normally, the a:hover type is behind the A:link and a:visited types, so the type of hover state can be applied to regular and access links. However, it does not have to follow this approach, you can change the type order to achieve different effects.
Suppose you want to use rollover effects in non-access links, but don't want to affect other access links, you might think of code to handle this form change, but all you have to do is rearrange the CSS code.
You can remove the rollover effect from the access link by simply removing the a:visited type. The following code changes the type order in the CSS code to change the rollover effect in the access link:
a:link {
color: #0000FF;
Text-decoration:underline;
Font-weight:normal;
Font-style:normal;
}
A:hover {
color: #0000FF;
Text-decoration:underline;
Background-color: #FFFF00;
Font-weight:bold;
Font-style:normal;
}
a:visited {
color: #3399FF;
Text-decoration:underline;
Background-color: #FFFFFF;
font-style:italic;
Font-weight:normal;
}
a:active {
color: #FF0000;
Text-decoration:none;
Background-color: #CCCCCC;
Font-weight:bold;
Font-style:normal;
}
Note that the a:visited type contains rules that specify all the same attributes as a:hover, otherwise any a:hover-type attributes that are not replaced by the a:visited type will continue to reappear when the visitor's mouse passes through an access link.
Add other effects
The previous type will continue to use the same element unless it is replaced by a different order type. Therefore, carefully selecting the characteristics and order of the link state type allows you to create different rollover effects on the non access and access links.
For example, remove the background color: #FFFFFF, the a:visited type rule in the second example code above will allow the background color to be applied from the A:hover type to the access link. The result adds the background color and bold text to the rollover effect of the non-access link.