语法
:read-write { css declarations; }
:read-write 选择器的例子:
<!DOCTYPE html> <html> <head> <title>文档的标题</title> <style> input { margin-bottom: 10px; border: 1px solid #ddd; padding: 5px; } input:-moz-read-only { background-color: #ccc; } input:read-only { background-color: #ccc; } #read-write:read-write { background: lightgreen; } </style> </head> <body> <h2>:read-write selector example</h2> <form> <div> <label for="read-write">Example1</label> <input value="read-write input" id="read-write"> </div> <div> <label for="read-only">Example2</label> <input readonly value="read-only input" id="read-only"> </div> </form> </body> </html>
:read-write 选择器选择用户可编辑的元素。
可编辑的元素包括:
- <input> 非只读且未禁用的元素。
- <textarea> 既不是只读的也不是禁用的。
- 一个不是 <input> 或者 <textarea> 的元素,并且具有 contenteditable 属性集。
:read-write 选择器在不同浏览器中的工作方式不同。
在一个浏览器中,它可以被认为是可读写的,但在另一种浏览器中,它可以被认为是只读的。
在某些浏览器中,可能不会应用该样式。
:read-only 选择器是 :read-write 选择器的对应物。
它选择所有不匹配的元素 :read-write。
日期:2020-06-02 22:14:45 来源:oir作者:oir