使用CSS:读写选择器选择没有“只读”属性的元素。
您可以尝试运行以下代码来实现:读写选择器
<!DOCTYPE html> <html> <head> <style> input:read-write { background-color: blue; color: white; } </style> </head> <body> <form> Subject: <input type = "text" name = "subject" value = "Java"><br> Student: <input type = "text" name = "student" readonly value = "Amit"><br> </form> </body> </html>