一个输入字段获得焦点时选择的样式:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
input:focus{
background-color: red;
}
</style>
</head>
<body>
<form action="">
<input type="text" name="">
</form>
</body>
</html>
未获得焦点
获得焦点