How to display and hide a div with CSS?

后端 未结 4 1347
夕颜
夕颜 2020-12-01 00:48

In my script there are three divs. I want to display div with class=\"ab\" when I hover on first line and display div with class=\"abc\", when hove

4条回答
  •  长情又很酷
    2020-12-01 01:09

    To hide an element, use:

    display: none;
    visibility: hidden;
    

    To show an element, use:

    display: block;
    visibility: visible;
    

    The difference is:

    Visibility handles the visibility of the tag, the display handles space it occupies on the page.

    If you set the visibility and do not change the display, even if the tags are not seen, it still occupies space.

提交回复
热议问题