設定樣式,為每個啟用的元素設定樣式,用 CSS
要為每個啟用的 <input> 元素設定樣式,請使用 CSS :enabled 選擇器。
示例
您可以嘗試執行以下程式碼,為啟用的 <input> 元素設定樣式
<!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>
廣告