Home  >  Article  >  Web Front-end  >  Usage of CSS :focus pseudo-class

Usage of CSS :focus pseudo-class

王林
王林forward
2023-08-26 15:01:081408browse

You can try to run the following code to achieve: focus pseudo-class

Example

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>

Output

CSS :focus 伪类的用法

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete