Posted in bootstrap
8899
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
280
This Month
1115
This Year
2629

No Items Found.

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

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
You drown not by falling in the river, but by staying submerged.
Unknown
Random CSS Property

scroll-margin-inline-start

The scroll-margin-inline-start property defines the margin of the scroll snap area at the start of the inline dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.
scroll-margin-inline-start css reference