Bootstrap show div on mouse hover

user2972061 picture user2972061 · Aug 3, 2017 · Viewed 14.1k times · Source

Is there any way to show Div on mouse hover on any html elements like td

Div has the HTML content in it.

enter image description here

Answer

Stanley Liu picture Stanley Liu · Aug 3, 2017

You can do this with CSS.

Example HTML:

<div id="to-hover">
    <div id="to-show"></div>
</div>

Example CSS:

#to-show {
    display: none;
}
#to-hover:hover > #to-show {
    display: block; 
}

You may need to change block to inline or some other value depending on the situation. Also you might need to use a different selector than > if they divs have a different relationship.