How to show hidden divs on mouseover?

后端 未结 5 1712
野的像风
野的像风 2020-12-01 00:16

How to show a set of hidden div\'s onmouseover?

For example :

Div 1 Content
Div 2 Content&l
5条回答
  •  没有蜡笔的小新
    2020-12-01 00:42

    There is a really simple way to do this in a CSS only way.

    Apply an opacity to 0, therefore making it invisible, but it will still react to JavaScript events and CSS selectors. In the hover selector, make it visible by changing the opacity value.

    #mouse_over {
      opacity: 0;
    }
    
    #mouse_over:hover {
      opacity: 1;
    }
    Now you see me

提交回复
热议问题