為所有已啟用的設定樣式元素與 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>
廣告