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>
广告