示例live demo
<!doctype html><html> <head> <style> input:invalid { background: red; } </style> </head> <body> <h2>heading</h2> <input type = "email" value = "invalidemail"> <p>the style (red color background) appears if you type an irrelevant/ invalid email address.</p> </body></html>
以上就是css的作用:无效的选择器的详细内容。