樣式使用 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.