Site logo

Archived topic

How to insert a Link Hover Effect (Border Bottom color) in my menu?

7 replies · Started by Cristiano on August 31, 2021

Viewing posts 1–8 of 8

How to insert a Link Hover Effect (Border Bottom color) in my menu?

I would like to insert Link Hover Effect, a red line at the bottom edge of the menu, so that it looks the same as what I sent in the sensitive area.

My website works like this:

1

I would like to get this effect:

2

Can you help me, please?

Hi there,

You can try this CSS:

.main-navigation ul li:hover > a {
  text-decoration: underline;
  text-decoration-color: red;
  text-decoration-thickness: 3px;
}

Or if you need to adjust things better, go with this instead.

.main-navigation ul li > a:after {
    content: "";
    background-color: red;
    width: 80%;
    height: 3px;
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}

.main-navigation ul li:hover > a:after {
    display:block;
}

Hi, thanks for your attention! Could you provide me with code that only works on the main menu? I don't need this effect in the submenu. Best Regards!

Try this:

.main-navigation .main-nav> ul > li > a:after {
    content: "";
    background-color: red;
    width: 80%;
    height: 3px;
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}

.main-navigation .main-nav > ul > li:hover > a:after {
    display:block;
}

It worked, thank you very much!

You are welcome :)

I like this! But how do I make it to only display on desktop? (not mobile and tablet).

This archived topic is closed to new replies.