Archived topic
Change button color
4 replies · Started by emanharout on December 26, 2020
Hello support team,
I set button colors via the customizer, inspected a button in my "About" page and it seems to work fine.
My issue is that when I inspect the element and grab the CSS selector and use it to change the colors manually, it won't work. I need to be able to select it for some work I'm doing on a dark theme.
Here is the css:
/* Default button state */
button, html input[type="button"], input[type="reset"], input[type="submit"], a.button, a.wp-block-button__link:not(.has-background) {
color: cyan;
background-color: red; /* random colors */
}
/* Hover state */
button:hover, html input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover, a.button:hover, button:focus, html input[type="button"]:focus, input[type="reset"]:focus, input[type="submit"]:focus, a.button:focus, a.wp-block-button__link:not(.has-background):active, a.wp-block-button__link:not(.has-background):focus, a.wp-block-button__link:not(.has-background):hover {
color: cyan;
background-color: red; /* random colors */
}
Hi there,
That selector should work but you didn't give any styles?
https://www.screencast.com/t/qLZQxaibzKT
Right, so I got the selector from the browser dev tools, and if I change the color in the browser it works. But if I copy the selector and use it in “Additional CSS” or styles.css, it has no effect. It’s puzzling.
Strange, it started to work. Wish I could share the fix for others in the future but I have no idea what did it. I'd previously cleared the cache and tried multiple browsers.
At any rate, I'll be closing this ticket. Thank you!
No problem :)