CSS Topic (v): Describes the link pseudo class A hover.

Source: Internet
Author: User

Background

For pseudo classes or link pseudo classes, we may all know some of the writing methods of tag a, a: hover, a: focus, a: visited, and then write different styles, it indicates the performance of the link in various States. We may also have encountered the input: focus format, indicating that the input box has encountered the focus style. For pseudo-classes, most people know and understand, or just remember lvoe and other tips. What is even more unclear is the specific meaning of each pseudo class. The following is a detailed explanation.

Binary link pseudo-category

Some pseudo classes are generated for links, and the link must contain the href attribute to show that it is a "Link ". In html, the link is a tag. The following two pseudo classes only apply to links:

1.: link, indicating a link that has not been accessed

2. visited indicates the accessed link, indicating that the mouse has been clicked or triggered by the keyboard. The hard drive of the browser remembers the user's clicking on the link. Therefore, if a link is clicked last time and opened again, it is still the visited style.

The style of the browser or default link. But we usually overwrite it. As follows:

a{color:gray}a:link{color:blue}a:visited{color:red}

As you can see, a {color: gray} is no longer in use and is covered by a: link {color: blue}. Therefore, the text color of the tag is blue.

Three dynamic pseudo classes

CSS2.1 adds three dynamic pseudo classes. It is often used to set the link style. In fact, these three pseudo classes can be applied to many elements. As follows:

1.: focus indicates the style in which the element obtains the focus. Generally, the focus is obtained through the Tab key of the keyboard. If you click the mouse, you may not be able to see the focus style of tag,

2.: hover, indicating the style of hovering the mouse over the element. A label is very commonly used.

3.: active, indicating the style when the mouse (mouse or keyboard) is clicked and the mouse is not released. This status needs to be carefully tested before you can understand the details.

Iv. Summary

Above, for the link to the tag, usually pay attention to the pseudo class order. Generally: link, visited, hover, and active. Now it is more popular: link, visited, focus, hover, and active. For general elements, you can only use focus, hover, active, etc. The most common is the style after the focus is obtained in the input box:

input :focus{    border:1px #F8A746 solid;    outline:1px #F6E0C5 solid;}

Five examples

Complete example of pseudo classes: www.zangb.com/html/demo/css/css_hover.html

Fang Jinsong, Nanjing focus technology, is written on

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.