Archived topic
How to add a hover underline in primary navigation.
1 reply · Started by Dipak Singh on March 25, 2021
Hello Tom, I want to add an underline when hovering primary menu links.
I have been using this CSS
.main-navigation .menu > .menu-item > a::after {
content: "";
position: absolute;
right: 0;
left: 50%;
bottom: 15px;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
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 > a:hover::after {
width: 50%;
}
But I want to hover above the links like this site primary menu links hovering
https://www.theminimalists.com/
please suggest what I do to make this
Hi there,
Try this CSS:
.main-navigation .menu > .menu-item > a:hover{
border-top: 1px solid transparent;
border-color: #000;
font-size: 12px;
margin: -1px 6.5px 0 6.5px;
padding: 18px 0 17px 0;
}