포커스가 있는 요소를 선택하려면 포커스 선택기를 사용합니다. 다음 코드를 실행하여 구현해 볼 수 있습니다. 포커스 선택기 −
예시
<!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>