Free CSS For Highlighting Menu Links in Elementor

/* Styling the nav menu links */
selector a {
    position: relative !important;
    padding: 5px 10px !important;
    display: inline-block !important;
    z-index: 1; /* Ensures the text is above the background */
    text-decoration: none; /* Removes any underline, if present */
}
 
/* Adding space between items */
selector li {
    margin: 0 10px; /* Adds 10px space on both sides of each item */
}
 
/* Alternating background colors */
selector li:nth-child(odd) {
    background: linear-gradient(to top, pink 50%, white 50%) !important; /* pink background on bottom half, pink on top */
}
 
selector li:nth-child(even) {
    background: linear-gradient(to top, yellow 50%, white 50%) !important; /* Yellow background on bottom half, pink on top */
}
 
/* Pink background always visible behind the text */
selector li::before {
    content: '';
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important; /* Align the background with the bottom of the text */
    height: 50% !important; /* Cover 50% of the text's height */
    background-color: Yellow !important; /* Yellow background */
    z-index: -1 !important; /* Ensures the background is behind the text */
}

Leave the first comment

Related Posts

Related Posts