'Toggle between tow divs on mouse hover

I need something like this: http://www.java2s.com/example/html-css/css-widget/show-div-and-hide-another-on-hover-with-transition.html

except that I need the div where I hover over (trigger) to be the same as the one that gets removed (and returns if I move the mouse away).

In my case I have a div that shows a card with a logo & headline (using bootstrap 5).

When I hover over that card, I want to change the content of the card to be a information text.



Solution 1:[1]

You can use css before with content and dispaly it when hovering https://developer.mozilla.org/en-US/docs/Web/CSS/::before

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ShobiDobi