Archived topic
How to custom just a part of the main menu.
9 replies · Started by Laurent on February 26, 2021
Hi,
I'm trying to customize just a part of a text in the main menu. See the picture here : https://www.screencast.com/t/mGnxErnv
So, I added a class for it.
But unfortunately, I can't change the main color (black in this case) to white.
I used the "!important" but without success.
Any idea how to change the color of the blue button showing ?
Thanks for your help.
Laurent.
Here the CSS I added :
/* --- BOUTON COMMANDER ---*/
.bouton-commander {
background-color: #8ed1fc; /* Blue */
border: none;
color: #ffffff !important ;
padding: 0px;
text-align: center;
text-decoration: none;
display: inline-block;
margin: 2px 1px;
cursor: pointer;
border-radius: 12px;
}
Hi there,
can you link me to the site so i can see what the issue is ?
Sure David ! Here is the link https://www.sepoi.com/
Your CSS selector needs to be more specific and the styles should be applied to the <a> element like so:
.main-navigation li.bouton-commander a,
.main-navigation li.bouton-commander.current-menu-item a {
background-color: #8ed1fc;
border: none;
color: rgb(240,96,204) !important;
padding: 0px;
text-align: center;
text-decoration: none;
display: inline-block;
margin: 2px 1px;
cursor: pointer;
border-radius: 12px;
}
For your hover styles you would use:
.main-navigation li.bouton-commander:hover a {
/* hover styles here */
}
Many thanks ! It works.
Glad to hear that
Hi,
Just a last thing.
When I am on the specific page linked to the button I create with the CSS, the button is showing only when hover. But not in a static mode.
How can I do to display it as set ?
You can see the demo video here : https://www.screencast.com/t/62p10XsWkqq
Thanks.
I have updated the CSS above to fix that.
Thank you !
You're welcome