CSS: Display (display) and Visibility (visibility)

Copyright: Original, welcome to reprint https://blog.csdn.net/weixin_43731793/article/details/91378448

1 Introduction

displayHow to set up a property should display element,
visibilityattribute specifies an element should be visible or hidden.

2, Tibetan elements - display: none or visibility: hidden

Hide an element by the display attribute set to "none", or the visibility property to "hidden". Note, however, these two methods will produce different results.

visibility:hiddenYou can hide an element, but hidden element still occupies the same space previously not hidden. In other words, although the element is hidden, but still affects layout.

display:noneYou can hide an element, and the hidden element will not take up any space. In other words, this element is not only hidden, and the space occupied by the original element will disappear from the page layout.

Guess you like

Origin blog.csdn.net/weixin_43731793/article/details/91378448