The :focus selector is used to select the element that has focus.
The :focus selector is allowed on elements that accept keyboard events or other user inputs.
Code :-
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
input:focus {
background: black;
color: white;
}
</style>
</head>
<body>
<input type="text">
<input type="text">
<input type="text">
<input type="text">
</body>
</html>
The :focus selector is allowed on elements that accept keyboard events or other user inputs.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
input:focus {
background: black;
color: white;
}
</style>
</head>
<body>
<input type="text">
<input type="text">
<input type="text">
<input type="text">
</body>
</html>
Css :- The focus selector
Reviewed by Network security
on
May 23, 2019
Rating:
No comments: