PHP前端开发

CSS :focus 伪类的用法

百变鹏仔 3个月前 (09-20) #CSS
文章标签 CSS

您可以尝试运行以下代码来实现 :focus 伪类

示例

现场演示

<!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>

输出