Analysis on css3 UI element status pseudo-class selector

不言
Release: 2018-06-14 16:30:24
Original
1347 people have browsed it

This article mainly introduces the UI element status pseudo-class selector of CSS3, including hover, active and focus, enabled, disabled read-only and read-write, etc. Friends who need it can refer to it

The so-called UI selector: The specified style only works 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                 支持firefox、safari、Opera、ie8、chrome            -------------
E:enabled             支持firefox、safari、Opera、chrome                    不支持ie8
E:disabled            支持firefox、 safari, Opera, and chrome do not support ie8
E:read-only support firefox and Opera do not support ie8, safari, chrome
E:read-write support firefox and Opera Does not support ie8, safari, chrome
E :checked Supports firefox, safari, Opera, and chrome Does not support ie8
E::selection Supports firefox, safari, Opera, and chrome Does not support ie8
E:default Only supports firefox ---------- --
E:indeterminate Only supports chrome Does not support ie8
E:valid Supports firefox and safari , Opera, Chrome does not support IE8
E: Required to support Firefox, Safari, Opera, Chrome, do not support IE8
E: Optional to support Firefox, Safari, Opera, Chrome does not support IE8
E: In-Range support firefox, safari, Opera, chrome Does not support ie8
E:out-of-rang Supports firefox, safari, Opera, chrome Does not support ie8
The following is a detailed description of its use;

1. Selectors E:hover, E:active and E:focus
1). The E:hover selector is used to specify when the mouse pointer moves to The style used by the element when the element is on
Usage method:
:hover{
CSS Style
}
We can use the "< element >" to add the type attribute of the element.
Example:
input[type="text"]:hover{
CSS style
}
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 the style used by the element to obtain the cursor focus. It is mainly used when the text box control obtains the focus and performs text input.

For example:

  
  
  
      
    选择器E:hover、E:active和E:focus  
      
  
  

选择器E:hover、E:active和E:focus

姓名:

密码:
Copy after login

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 an enabled state.
2). The E:disabled selector is used to specify the style when the element is in a disabled state.

For example:

  
  
  
      
    E:enabled伪类选择器与E:disabled伪类选择器  
      
  
  

E:enabled伪类选择器与E:disabled伪类选择器

姓名:

学校:
Copy after login

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 the 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.

  
  
  
      
    read-only伪类选择器与E:read-write伪类选择器  
      
  
  

read-only伪类选择器与E:read-write伪类选择器

姓名:

学校:
Copy after login

4. Pseudo-class selectors E:checked, E:default and indeterminate
1). E:cehcked pseudo-class selector is used to specify the current The style of the radio radio button or checkbox in the form when it is selected.
2). The E:default selector is used to specify the style of the radio button or check box control that is in the selected state by default when the page is opened.
3). The E:indeterminate selector is used to specify the style of the entire group of radio button boxes when no single radio button box in a group of radio button boxes is set to the selected state when the page is opened.

  
  
  
      
    checked伪类选择器  
      
  
  

checked伪类选择器

房屋状态: 天然气 宽带
Copy after login

Default selection items

  
  
  
      
    default伪类选择器  
      
  
  

default伪类选择器

房屋状态: 天然气 宽带
Copy after login

indeterminate伪类选择器

indeterminate伪类选择器

indeterminate伪类选择器

性别:
Copy after login

5. Pseudo class selector E::selection
1), E:selection pseudo Class selectors are used to specify styles when an element is selected.

For example

  
  
  
      
    伪类选择器E::selection  
      
  
  

伪类选择器E::selection

今天,开发搜索框,出现了bug,现在没有找到原因!今天,开发搜索框,出现了bug,现在没有找到原因!今天,开发搜索框,出现了bug,现在没有找到原因!今天,开发搜索框,出现了bug,现在没有找到原因!今天,开发搜索框,出现了bug,现在没有找到原因!

Copy after login

6, E:invalid pseudo-class selector and E:valid pseudo-class selector
1), E The :invalid pseudo-class selector is used to specify the style when the element content cannot pass the check specified by HTML5 using attributes such as requirede of the element or the element content does not conform to the format specified by the element.
2). The E:valid pseudo-class selector is used to specify the style when the element content can pass the check specified by HTML5 by using attributes such as requirede of the element or when the element content conforms to the format specified by the element.

For example

  
  
  
      
    E:invalid伪类选择器与E:valid伪类选择器  
      
  
  

E:invalid伪类选择器与E:valid伪类选择器

Copy after login

7, E:required pseudo-class selector and E:optional pseudo-class selector
1), E The :required pseudo-class selector is used to specify the styles of input elements, select elements, and textarea elements that are allowed to use the required attribute and have the required attribute specified.
2). The E:optional pseudo-class selector is used to specify the style of input elements, select elements and textarea elements that are allowed to use the required attribute and the required attribute is not specified.

  
  
  
      
    E:required伪类选择器与E:optional伪类选择器  
      
  
  

E:required伪类选择器与E:optional伪类选择器

姓名:

学校:
Copy after login

8. E:in-range pseudo-class selector and E:out-of-range pseudo-class selector
1), E: The in-range pseudo-class selector is used to specify the style when the valid value of the element is limited to a range and the actual input value is within this range.
2). The E:out-of-range pseudo-class selector is used to specify the style to be used when the effective value of the element is limited to a range, but the actual input value exceeds it.

For example

  
  
  
      
    E:in-range伪类选择器与E:out-of-range伪类选择器  
      
  
  

E:in-range伪类选择器与E:out-of-range伪类选择器

Copy after login

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Analysis on the difference between using rgba and opacity to set transparency in css

The above is the detailed content of Analysis on css3 UI element status pseudo-class selector. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!