CSS :in-range 選擇器的作用
使用 CSS :in-range 選擇器來設定值在指定範圍內的 <input> 元素的樣式。您可以嘗試執行以下程式碼來實現 :in-range 選擇器 −
示例
<!DOCTYPE html> <html> <head> <style> input:in-range { border: 3px dashed orange; background: yellow; } </style> </head> <body> <input type = "number" min = "5" max = "10" value = "9"> <p>The style only works for the value entered i.e. 9</p> </body> </html>
廣告