Advertisement
tex2005

Animated Underline

Dec 27th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.59 KB | None | 0 0
  1. /* ref: https://tobiasahlin.com/blog/css-trick-animating-link-underlines/
  2. */
  3. li.menu-item > a {
  4.   position: relative;
  5. }
  6. li.menu-item > a:before {
  7.   content: "";
  8.   position: absolute;
  9.   width: 100%;
  10.   height: 2px;
  11.   bottom: 0;
  12.   left: 0;
  13.   background-color: #ccc;
  14.   visibility: hidden;
  15.   -webkit-transform: scaleX(0);
  16.   transform: scaleX(0);
  17.   -webkit-transition: all 0.3s ease-in-out 0s;
  18.   transition: all 0.3s ease-in-out 0s;
  19. }
  20. li.menu-item > a:hover:before {
  21.   visibility: visible;
  22.   -webkit-transform: scaleX(1);
  23.   transform: scaleX(1);
  24. }
  25. li.menu-item {
  26.   padding: 4px 8px;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement