Learn about the pseudo class of CSS

Source: Internet
Author: User

Unlike the general CSS syntax, there are two types of syntax for CSS pseudo classes.

First type:

Selector:pseudo-class {Property:value}

You can also use the HTML class attribute to set pseudo classes.

Example:

a:link {color:red}

The second type:

Selector.class:pseudo-class {Property:value}

Pseudo classes are the most commonly used pseudo classes.

Example:

A.c1:link {color:red}

Anchor (a) pseudo class

Anchor (a) pseudo class is the most commonly used pseudo class. Examples are as follows:

a:link {color: #FF0000}/* not visited link red *

a:visited {color: #00FF00}/* has been visited Link green *

a:hover {color: #FFCC00}/* Mouse hover over the link orange *

a:active {color: #0000FF}/* Mouse point active link Blue */

You can also use the HTML class attribute to set pseudo classes. Examples are as follows:

A.c1:link {color: #FF0000}/* not visited link red *

a.c1:visited {color: #00FF00}/* has been visited Link green *

a.c1:hover {color: #FFCC00}/* Mouse hover over the link orange *

a.c1:active {color: #0000FF}/* Mouse point active link Blue */

Example: actived in order to write.

Note: Due to the CSS priority of the relationship (later than the previous priority), in the write a CSS, must be in accordance with A:link, a:visited, A:hover, a:actived the order of writing.



Related Article

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.