Analysis of the UI element State pseudo-class selector for CSS3

Source: Internet
Author: User
This article mainly introduces the CSS3 UI element State pseudo-class selector, including hover, active and focus,enabled,disabledread-only and Read-write, and so on, the need for friends can refer to the following

The so-called UI selector: The specified style works only when the element is in a certain state and does not work in the default state!

Browser compatibility:

e:hover supports Firefox, Safari, Opera, IE8, Chrome------------
E:active supports Firefox, Safari, Opera, Chrome does not support IE8
E:focus support Firefox, Safari, Opera, IE8, Chrome-------------
e:enabled support for Firefox, Safari, Opera , Chrome does not support IE8
e:disabled support Firefox, Safari, Opera, Chrome does not support IE8
E:read-only support Firefox, Opera does not support IE8, Safari, Chrome
E:read-write support Firefox, Opera does not support IE8, Safari, Chrome
e:checked support Firefox, Safari, Opera, Chrome does not support IE8
E :: Selection Support Firefox, Safari, Opera, Chrome does not support IE8
E:default only Firefox------------
E:indeterminate only support chrome- -----------
E:invalid support Firefox, Safari, Opera, Chrome does not support IE8
E:valid support Firefox, Safari, Opera, Chrome does not support IE8
E : Required support Firefox, Safari, Opera, Chrome does not support IE8
E:optional support Firefox, Safari, Opera, Chrome does not support IE8
E:in-range Support for Firefox, Safari, Opera, Chrome does not support IE8
E:out-of-rang support Firefox, Safari, Opera, Chrome does not support IE8
below for detailed instructions on its use;

1. Selector E:hover, e:active and E:focus
1), the E:hover selector is used to specify the style used by the element when the mouse pointer moves over the element
How to use:
< Elemental >:hover{
CSS Styles
}
We can add the element's type property in < element >.
Cases:
Input[type= "Text"]:hover{
CSS Styles
}
2), the e:active selector is used to specify the style used when the element is activated
3), the E:focus selector is used to specify that the element gets the style used by the cursor focus point, mainly when the text box control obtains the focus point and uses it for text input.

For example:

<! DOCTYPE html> 

2. e:enabled pseudo-class selector and e:disabled pseudo-class selector
1), the e:enabled selector is used to specify the style when the element is in the available state.
2), the e:disabled selector is used to specify the style when the element is in an unavailable state.

For example:

<! DOCTYPE html>  

3. E:read-only pseudo-class selector and e:read-write pseudo-class selector
1), the e:read-only selector is used to specify the style when the element is in a read-only state.
2), the E:read-write selector is used to specify the style when the element is in a non-read-only state.

<! DOCTYPE html>  

4. Pseudo-class selector e:checked, E:default and indeterminate
1), e:cehcked Pseudo-class selector is used to specify the style when the Radio radio box or CheckBox check box is selected in the form.
2), the E:default selector is used to specify the style of the control that is selected by default when the page is opened by a radio box or check box.
3), the e:indeterminate selector is used to specify the style of the entire set of radio boxes when the page is open and none of the radio boxes in a set of radio boxes are set to the selected state.

<! DOCTYPE html>  

The default selection

<! DOCTYPE html> 

5. Pseudo-Class selector e::selection
1), e:selection Pseudo-class selector is used to specify the style when the element is selected.

For example

<! DOCTYPE html>  

6. E:invalid pseudo-class selector and e:valid pseudo-class selector
1), the e:invalid pseudo-class selector is used to specify the style when the element content cannot be specified by HTML5 by using elements such as requirde, such as attributes such as the check or element content that does not conform to the formatting prescribed by the element.
2), the E:valid pseudo-class selector is used to specify the style when the element content can be specified by HTML5 by using elements such as requirde, such as the check or element content that conforms to the format defined by the element.

For example

<! DOCTYPE html>  

7, e:required pseudo-class selector and e:optional pseudo-class selector
1), the e:required pseudo-class selector is used to specify the style of the INPUT element, the Select element, and the textarea element that are allowed to use the required property and have specified the Required property.
2), the e:optional pseudo-class selector is used to specify the style of the INPUT element, the Select element, and the textarea element that are allowed to use the required property without specifying the Required property.

<! DOCTYPE html> 

8. E:in-range pseudo-class selector and E:out-of-range pseudo-class selector
1), E:in-range Pseudo-class selector is used to specify the style when the valid value of an element is limited to a certain range, and the actual input value is within that range.
2), E:out-of-range Pseudo-class selectors are used to specify styles that are used when the valid value of an element is limited to a certain range, but the actual input value is exceeded.

For example

<! DOCTYPE html>  

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

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.