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

49 次瀏覽

開啟你的 職業生涯

完成課程,獲得認證

開始吧
廣告
© . All rights reserved.