I have an input element.
- The element has Black border initially.
- I'm applying blue border to it when the element is focused.
Requirement: Now when I remove the focus from it, I want the border to be red.
I tried with input:not(focus) but it's changing the initial state also.
input {
border: none;
border-bottom: 2px solid black;
outline: none;
transition: 0.4s ease-out;
}
input:focus {
border-bottom: 2px solid blue;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="field">
<input type="text" required>
</div>
</body>
</html>