You can try to run the following code to achieve: focus pseudo-class
Live demonstration
<!DOCTYPE html> <html> <head> <style> input:focus { background-color: orange; } </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"><br> <input type = "submit" value = "Submit"> </form> </body> </html>
The above is the detailed content of Usage of CSS :focus pseudo-class. For more information, please follow other related articles on the PHP Chinese website!