CSS 的作用:disabled 選擇器
使用 CSS :disabled 選擇器來設定樣式每個 停用的 <input> 元素。你可以嘗試執行下面程式碼來實現 :disabled 選擇器
示例
<!DOCTYPE html> <html> <head> <style> input:enabled { background: blue; } input:disabled { background: red; } </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>
廣告