What are css3 selectors: read-write and :read-only? how to use?
This article brings you an introduction to the css3 selectors: read-write and: read-only. How to use it, let everyone know what the :read-write selector and :read-only selector of CSS3 are, what they do, and how to use them. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
css3 :read-write
:read-write is a pseudo-class selector in CSS, which is used to match user-editable elements, that is, readable and writable elements.
Elements belonging to the editable category include:
1. elements (of any type) that are not read-only and not disabled. This means that they have neither the readonly nor the disabled attribute set.
2. A
3. Any other element that is not or
Note: Currently, in most browsers, the :read-write selector can only be used to set input and textarea elements.
css3 :read-only
:read-only is also a pseudo-class selector in CSS, matching anything that does not match the :read-write selector element.
In other words, the :read-only pseudo-class selector matches elements that cannot be edited by the user, that is, it matches any element that is not editable above ↑. For example: elements with attributes such as readonly or disabled set.
The following are examples of elements that can be matched using: read-write:
< input type = “text” > < input type = “number” > < textarea name = “nm” id = “id” cols = “30” rows = “10” > </ textarea > < div class = “random” contenteditable > </ div >
The following are examples of elements that cannot be matched using: read-write, that is, examples of elements that can be matched using: read-only :
< input type = “text” disabled > < input type = “number” disabled > < input type = “number” readonly > < textarea name = “nm” id = “id” cols = “30” rows = “10” readonly > </ textarea > < div class = “random” > </ div > <! - 无法使用contenteditable编辑的常规元素 - >
Although this is the behavior recommended by the specification, browser behavior appears to vary: what may be considered read and write in one browser will be considered read and written in another browser. Read-only, so the :read-write style we apply may not work with some browsers.
Like other pseudo-class selectors, both the :read-write selector and the :read-only selector can be linked with other selectors, such as :hover and the pseudo-element ::after.
For example, :read-write :focus will provide the style for the editable text area:
textarea:read-write:focus { box-shadow: 0 0 2px 1px rgba(0,0,0,0.2); } textarea:read-write:before { content: "Type here..."; color: #aaa; }
For example, :read-only :hover will provide the style for the div (regular) on the page:
div:read-only:hover { background-color: #eee; } div:read-only:before { content: "?"; color: deepPink; }
Browser support
The number in the table indicates the first browser version number that supports this attribute.
In Firefox browser, use the prefix: -moz-read-write, -moz-read-only; and the read-write selector and read-only selector are not supported on Internet Explorer and Android use.
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study. Recommended related video tutorials: CSS3 tutorial!
The above is the detailed content of What are css3 selectors: read-write and :read-only? how to use?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



In CSS, you can use the border-image attribute to achieve a lace border. The border-image attribute can use images to create borders, that is, add a background image to the border. You only need to specify the background image as a lace style; the syntax "border-image: url (image path) offsets the image border width inward. Whether outset is repeated;".

In CSS, the identifier of the id selector is "#". You can specify a specific style for the HTML element marked with a specific id attribute value. The syntax structure is "#ID value {attribute: attribute value;}". The ID attribute is unique and non-repeatable in the entire page; the ID attribute value should not start with a number. IDs starting with numbers will not work in Mozilla/Firefox browsers.

Use the :nth-child(n+3) pseudo-class selector to select the style of child elements whose position is greater than or equal to 3. The specific code example is as follows: HTML code: <divid="container"><divclass="item"> ;First child element</div><divclass="item"&

The JavaScript selector fails because the code is not standardized. The solution is: 1. Remove the imported JS code and the ID selector method will be effective; 2. Just introduce the specified JS code before introducing "jquery.js".

This article will introduce a new feature, starting from Chrome 90, a new feature added to overflow - overflow: clip. Use it to easily control the overflow direction.

Not included. CSS selectors include: 1. Tag selector, which locates specific HTML elements through the element name of the HTML page; 2. Class selector, which locates specific HTML elements through the value of the class attribute of the HTML element; 3. ID selector, which Locate specific HTML elements through the value of the id attribute of the HTML element; 4. The wildcard selector "*" can refer to all types of tag elements, including custom elements; 5. The attribute selector uses the existing attribute name of the HTML element or attribute value to locate a specific HTML element.

In-depth analysis of is and where selectors: improving the level of CSS programming Introduction: In the process of CSS programming, selectors are an essential element. They allow us to select and style elements in an HTML document based on specific criteria. In this article, we will take a deep dive into two commonly used selectors namely: is selector and where selector. By understanding their working principles and usage scenarios, we can greatly improve the level of CSS programming. 1. is selector is selector is a very powerful choice

How to add logo to favicon using SVG? The following article will introduce to you how to use SVG to generate favicon with logo. I hope it will be helpful to you!
