javascript - Animate LENGTH of border-bottom -


i have navbar. on hover of of menu item want have exact same effect of border-bottom animation in here (see how border or menu items @ top-left animates when hover them.)

i tried find similar asked questions on stackoverflow , on google didn't find helpful.

any appreciated.

well, easy inspecting web developer tools. in page create element inside menu using :before pseudo-element. on hover use css transforms (scale) change length.

jsfiddle.

span {     display: inline-block;     padding: 6px 0px 4px;     margin: 0px 8px 0px;     position: relative; }  span:before {     content: '';     position: absolute;     width: 100%;     height: 0px;     border-bottom: 1px solid black;     bottom: 2px;     -webkit-transform: scalex(0);     -ms-transform: scalex(0);     transform: scalex(0);     -webkit-transition: -webkit-transform 0.2s ease-in;     transition: transform 0.2s ease-in; }  span:hover:before {     -webkit-transform: scalex(1);     -ms-transform: scalex(1);     transform: scalex(1); } 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -