Is it possible to reduce the label size when focused for text input and restore it when no text is entered or clicking elsewhere? Here is the code snippet I have been experimenting with:
div {
height: 50px;
width: 200px;
border-bottom: 1px solid black;
-webkit-transition: width 2s;
transition: width 2s;
}
div:focus {
background-color: transparent;
width: 300px;
tansition: ease;
outline: 1px solid black;
}
label {
font-size: 20px;
}
<div tabindex="0">
<label>Three-colored border!</label>
</div>
Is there a way to achieve this effect using only CSS, or would JavaScript or AngularJS be required?