为带有 CSS 焦点的元素设置样式
要选择具有焦点的元素,请使用:focus 选择器。您可以尝试运行以下代码来实现:focus 选择器 −
示例
<!DOCTYPE html>
<html>
<head>
<style>
input:focus {
background-color: green;
}
</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>
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP