css - Input[type=text] transition delay not working -
i'm using following styles simple input text box, , want dashed border animate solid on focus , vice versa.
input { font-family: inherit; font-size: large; border: 2px solid #1bd55a; border-radius: 5px; } input[type=text] { width: 500px; height: 30px; color: #616161; padding-left: 6px; border-style: dashed; background-color: rgba(27, 213, 90, 0.12); transition: 0.3s; } input[type=text]:focus { border-style: solid; outline: none; /* gets rid of blue outline. */ }
however current code, transition between dash , solid immediate, no animation there. i'm animating single property, , know it's possible make work svg's stroke
property, how can apply text input?
unfortunately border-style not animatable property. however, achieve effect markup , border-color.
input { font-family: inherit; font-size: large; border: 2px solid #1bd55a; border-radius: 5px; } input[type=text] { width: 500px; height: 30px; color: #616161; padding-left: 6px; background-color: rgba(27, 213, 90, 0.12); border-color: rgba(27, 213, 90, 0.12); transition: 0.3s; margin: -2px; } input[type=text]:focus { border-color: #1bd55a; outline: none; /* gets rid of blue outline. */ } div.extra-border { display: inline-block; border: 2px dashed #1bd55a; border-radius: 5px; }
<div class="extra-border"> <input type="text" placeholder="text here" /> </div>
here fiddle. not precisely same transition svg
s give you, not bad.
Comments
Post a Comment