How to display and hide a div with CSS?

后端 未结 4 1355
夕颜
夕颜 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:20

    you can use any of the following five ways to hide element, depends upon your requirements.

    Opacity

    .hide {
      opacity: 0;
    }
    

    Visibility

    .hide {
       visibility: hidden;
    }
    

    Display

    .hide {
       display: none;
    }
    

    Position

    .hide {
       position: absolute;
       top: -9999px;
       left: -9999px;
    }
    

    clip-path

    .hide {
      clip-path: polygon(0px 0px,0px 0px,0px 0px,0px 0px);
    }
    

    To show use any of the following: opacity: 1; visibility: visible; display: block;

    Source : https://www.sitepoint.com/five-ways-to-hide-elements-in-css/

提交回复
热议问题