格式CSS 設定元素 的樣式,使其值超出指定範圍


使用 CSS :out-of-range 選擇器設定 <input> 元素的樣式,使其值超出指定範圍。

例項

您可嘗試執行以下程式碼來實現 :out-of-range 選擇器

動態演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         input:out-of-range {
            border: 3px dashed orange;
            background: yellow;
         }
      </style>
   </head>
   <body>
      <input type = "number" min = "5" max = "10" value = "15">
      <p>The style only works for the value entered out of range</p>
   </body>
</html>

更新於: 01-Jul-2020

117 次瀏覽

助力您的 職業

完成課程即可獲得證書

開始
廣告
© . All rights reserved.