We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.box { display: none; }
.box { visibility: hidden; }
visibility
visibility:visible
visible
hidden
.box { opacity: 0; }
animation
opacity
GPU
composite
opacity: 1
.box { position: relative; left: -10000px; top: -10000px; }
position
position: inherit
relative
fixed
inherit
top
bottom
right
left
.box { position: absolute; top: -9000px; left: -9000px; }
将元素的margin,border,padding,height和width等影响元素盒模型的属性设置成0,如果元素内有子元素或内容,还应该设置其overflow:hidden来隐藏其子元素
margin
border
padding
height
width
0
overflow:hidden
.hiddenBox { margin:0; border:0; padding:0; height:0; width:0; overflow:hidden; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
一、display: none
二、visibility: hidden
visibility
属性可继承,子元素可以通过设置visibility:visible
来实现可见visible
,那么子元素的点击事件可被触发,此时visibility
为hidden
的父级元素的事件会在事件冒泡阶段被触发三、opacity: 0
animation
动画,对opacity
做变化(animation
会默认触发GPU
加速),则只会触发GPU
层面的composite
,不会触发重绘opacity
可被继承,子元素可以通过设置opacity: 1
来实现可见四、position: relative
position
属性可被继承(position: inherit
),子元素可以通过设置relative
、position
、fixed
、inherit
配合top
、bottom
、right
、left
值重新进行定位。五、position: absolute
position
属性可被继承(position: inherit
),子元素可以通过设置relative
、position
、fixed
、inherit
配合top
、bottom
、right
、left
值重新进行定位。六、设置height、width属性为0
将元素的
margin
,border
,padding
,height
和width
等影响元素盒模型的属性设置成0
,如果元素内有子元素或内容,还应该设置其overflow:hidden
来隐藏其子元素参考文献
The text was updated successfully, but these errors were encountered: