Here is a cool piece of CSS to achieve this effect:
@media (min-width: 769px) { .main-navigation .menu > .menu-item > a::after { content: ""; position: absolute; right: 0; left: 50%; bottom: 15px; -webkit-transform: translate3d(-50%,0,0); transform: translate3d(-50%,0,0); display: block; width: 0; height: 2px; background-color: currentColor; transition: 0.3s width ease; } .main-navigation .menu > .menu-item.current-menu-item > a::after, .main-navigation .menu > .menu-item.current-menu-ancestor > a::after, .main-navigation .menu > .menu-item > a:hover::after { width: 50%; } }