CSS 的作用:out-of-range 選擇器


使用 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>

更新於: 2020 年 7 月 1 日

49 次瀏覽

開啟您的 職業生涯

透過完成課程獲得認證

開始學習
廣告