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.

Related Search Terms
Page Views

This page has been viewed 112 times.

Search Code
Search Code by entering your search text above.

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.


Random Quote
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better. You won't believe what you can accomplish by attempting the impossible with the courage to repeatedly fail better.