CSS :enabled 選擇器的作用


使用 CSS :enabled 選擇器來規定每個啟用的 <input> 元素的樣式。您可以嘗試執行下列程式碼來實現 :enabled 選擇器 −

示例

線上演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         input:enabled {
            background: blue;
         }
      </style>
   </head>
   <body>
      <form action = "">
         Subject <input type = "text" name = "subject"><br>
         Student: <input type = "text" name = "student"><br>
         Age: <input type = "number" name = "age" disabled><br>
      </form>
   </body>
</html>

更新於: 2020 年 6 月 30 日

157 次瀏覽

開啟您的 職業生涯

透過完成課程獲得認證

開始學習
廣告
© . All rights reserved.