The pseudo-class of CSS

Source: Internet
Author: User


: hover--css:hover pseudo class, applies to the cursor (mouse pointer) pointing to an element, but the style when this element is not activated
    • Grammar::hover
    • CSS version: CSS2
    • Citation URL: http://www.dreamdu.com/css/pseudo-class_hover/
    • Description
      • Applies to a cursor (mouse pointer) that points to an element, but when this element is not activated
      • The client (browser) can change the rendering effect according to the user's interaction, CSS provides three pseudo-classes for this situation: hover , active ,focus
      • The above three pseudo-classes are not mutually exclusive, and one element can be applied to several of them simultaneously.
      • : hover pseudo-class for when a user points to an element, such as a user's mouse pointing to a paragraph p. When the user mouse leaves the element, the original style of the restored element is displayed
    • Hover, Chinese "stay, hover" meaning
Grammar
:hovera:hovera.class:hover
Example
a:hover {color:yellow;background:blue;font-size:small;}p:hover{color:yellow;background:blue;font-size:large;}div:hover{color:red;background:lime;font-size:small;}

Internet Explorer does not support elements other than elements of a: hover pseudo-Class

IE6, IE7 (q), IE8 (q) Browsers do not support elements other than elements of a: hover pseudo-class, which can be tested by the example above

sequence of Pseudo-class selectors: L-v-h-a

CSS provides four kinds of pseudo-class settings link color, including: Link,: visited,: hover,: active, their declarations are in a certain order, we will call this order as l-v-h-a, that is, link first, then visited, then hover, Last active, so declared to ensure that the correct style is displayed for hover and active states

Example
a:link{color: red;}a:visited{color: green;}a:hover{color: blue;}a:active{color: black;}

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.