Posted in bootstrap
2
12:31 am, November 23, 2020

Fix Hover Over color on list group dark mode in bootstrap

How to fix the problem when switching to dark mode, the list group item text disappears when active.

Here is what it currently looks like.

To fix this we need to target the element and force the state to active or hover, in chrome press f12 and then use the selector to target the element.

to force a state on an element so we can change it, right click it in the console., and then go to force state, and select hover over. this will stick the element in hover over mode, like the mouse is over it or it being clicked.

now if you look at it it will be all white, which is what we need to fix.

this is the css culprit that is causing the text to be white.

so to fix we can either change the text to black or the hover over to a light gray rather than the white. the normal button hover over looks nice so ill use that.

copy these styles to our list element

so we end up with this

Now save the styles to your main css file, I usually add a theme.css file that loads the changes under the bootstrap.css so you can easily override existing styles, so just add all changes to this.

Reload and test and you should have something like this in your list group hover over.

All fixed, however. this also applies to the white or light version which is annoying, so may need to modify the darkmode switch to also add a tag to the body so that we can target if the site it in dark or light mode, as currently we cant target light or dark mode without changing the light or dark css.

View Statistics
This Week
45
This Month
130
This Year
0

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

Join me on Substack if you want me to send you a collection of the things i have done or found or read for the week. Or follow me on twitter if you prefer, i dont post much but i probably should!

❤👩‍💻🕹

Random Quote
The problem with hoarding is you end up living off your reserves. Eventually, you’ll become stale. If you give away everything you have, you are left with nothing. This forces you to look, to be aware, to replenish. . . . Somehow the more you give away, the more comes back to you.
Paul Arden