The difference between pseudo-class Link,hover,active,visited,focus

Source: Internet
Author: User

/*css*/
a:link{
Color:blue;
}
a:visited{
Color:green;
}
a:hover{
color:red;
}
a:focus{
Color:black;
}
a:active{
Color:yellow;
}

/*html*/
<p><a href= "#" >click me</a></p>

Link indicates the colors that the links display under normal circumstances, that is, when the page has just been loaded.

Hover represents the color that is displayed when the mouse hovers.

Active represents the color that is displayed when the indicated element is in the active state (the mouse is pressed on the element without releasing it).

The focus represents the color used when the element gets the cursor focus, and is used primarily for text box input text. Cases:

/*css*/
#txt: focus{
background-color:red;
}

/*html*/
<input type= "text" id= "TXT" >

Note: Active is equivalent to focus at this point, and the display is determined by the position of active and focus.

Note Two: The Order of pseudo-classes should be link--visited--hover--focus--active.

Note three: link with active, text box with focus.

Note Four: Active more than hover is used together.

The difference between pseudo-class Link,hover,active,visited,focus

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.