12/08/2018, 13:47

6 cách hide elements trong CSS

Opacity .hide { opacity : 0 ; } http://codepen.io/SitePoint/pen/bedZrR Visibility .hide { visibility : hidden ; } http://codepen.io/SitePoint/pen/pbJYpV Display .hide { display : none ; } http://codepen.io/SitePoint/pen/zBGbjb Position ...

Opacity

.hide {
  opacity: 0;
}

http://codepen.io/SitePoint/pen/bedZrR

Visibility

.hide {
   visibility: hidden;
}

http://codepen.io/SitePoint/pen/pbJYpV

Display

.hide {
   display: none;
}

http://codepen.io/SitePoint/pen/zBGbjb

Position

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

http://codepen.io/SitePoint/pen/QEboZm

Clip-path

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

http://codepen.io/SitePoint/pen/YWXgdW

Height & Font size

.hide{
  height:0;
  font-size:0;
  border: 0;
}

http://jsbin.com/cuhuxizahe/edit?html,css,output

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

0