Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <style> input:required { background-color: yellow; } </style> </head> <body> <h3>A demonstration of the :required selector.</h3> <p>An optional input element:<br><input></p> <p>A required input element:<br><input required></p> <p> :required选择器选择表单元素有“需要”属性.</p> </body> </html>