Underline For Active Menu Item - Question | JoomShaper
Black Friday sale is live with flat 50% OFF. Sale ends soon! Grab your deal now!

Underline For Active Menu Item

D

damian

Template 2 years ago

how do i get the active menu item to have an underline?

0
8 Answers
Mehtaz Afsana Borsha
Mehtaz Afsana Borsha
Accepted Answer
Support Agent 2 years ago #113812

Hi

Thanks for contacting us. Use this custom CSS

.sp-megamenu-parent>li.active>a, .sp-megamenu-parent>li.active:hover>a {
    text-decoration: underline;
}

Path towards custom CSS: Extensions>Templates>Styles> Click on your current default template name then choose Template Options. Then find custom CSS within the custom code.

-Regards.

0
D
damian
Accepted Answer
2 years ago #113815

Thanks. And how about to move the line by say 5px lower?

0
Mehtaz Afsana Borsha
Mehtaz Afsana Borsha
Accepted Answer
Support Agent 2 years ago #113845

Sorry this option is not available.

0
D
damian
Accepted Answer
2 years ago #113866

I nearly got it to work with this

/* Target the active menu item */
.sp-megamenu-parent>li.active {
  position: relative;
}

/* Target the line under the active menu item */
.sp-megamenu-parent>li.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px; /* Adjust the height of the line */
  background-color: #fff; /* Set the color of the line */
  transform: translateY(5px); /* Adjust this value to move the line up or down */
}

and this

/* Target the active menu item */
.menu-item.active {
  position: relative;
}

/* Target the line under the active menu item */
.menu-item.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px; /* Adjust this value to move the line up or down */
  height: 2px; /* Adjust the height of the line */
  background-color: #000; /* Set the color of the line */
}

that chatGPT gave me .. but it wasn't great. thanks anyway.

0
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 2 years ago #113867

I would use

.sp-megamenu-parent > li.active > a, 
.sp-megamenu-parent > li.active:hover > a 
{border-bottom: 2px solid red; padding-bottom:5px;} 
0
HS
Hannah Silver
Accepted Answer
1 year ago #140841

That "lower line" code worked fine for me; Ubuntu 22.04, Firefox 120.0.1. Perhaps a difference between browsers.

0
D
damian
Accepted Answer
2 years ago #114155

Thanks .. none of it worked.

0
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 2 years ago #114164

weird, worked on my demo.

0