My simple border bottom animation is working fine with a basic input element, but it's not functioning properly when used with a textarea. (If using JavaScript is necessary for a solution, please provide guidance)
How can I adjust the height of a textarea?
*{
box-sizing: border-box;
}
.container {
position: relative;
}
textarea,
input {
border: none;
border-bottom: 3px solid #e6e6e6;
width: 100%;
height: 50px;
resize: none;
}
.anim-bar {
position: absolute;
bottom: 0;
left: 0;
height: 3px;
width: 0%;
background-color: blue;
-webkit-transition: width .3s;
transition: width .3s;
}
textarea:focus + .anim-bar,
input:focus + .anim-bar {
width: 100%;
}
<h1>Works fine on input :)</h1>
<div class="container">
<input type="text">
<span class="anim-bar"></span>
</div>
<h1>Cross the container box- textarea :( </h1>
<div class="container">
<textarea></textarea>
<span class="anim-bar"></span>
</div>