样式使用 CSS 设置无 "readonly" 属性的元素的样式


使用 CSS 的 read-write 选择器选择没有 "readonly" 属性的元素。

示例

你可以尝试运行以下代码来实现:read-write 选择器

在线演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         input:read-write {
            background-color: blue;
            color: white;
         }
      </style>
   </head>
   <body>
      <form>
         Subject: <input type = "text" name = "subject" value = "Java"><br>
         Student: <input type = "text" name = "student" readonly value = "Amit"><br>
      </form>
   </body>
</html>

更新于:2020 年 7 月 1 日

375 次浏览

开启您的 职业生涯

完成课程并获得认证

开始学习
广告
© . All rights reserved.