可见性:隐藏和显示:无有什么区别?

What is the difference between visibility:hidden and display:none?(可见性:隐藏和显示:无有什么区别?)

本文介绍了可见性:隐藏和显示:无有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

The CSS rules visibility:hidden and display:none both result in the element not being visible. Are these synonyms?

解决方案

display:none means that the tag in question will not appear on the page at all (although you can still interact with it through the dom). There will be no space allocated for it between the other tags.

visibility:hidden means that unlike display:none, the tag is not visible, but space is allocated for it on the page. The tag is rendered, it just isn't seen on the page.

For example:

test | <span style="[style-tag-value]">Appropriate style in this tag</span> | test

Replacing [style-tag-value] with display:none results in:

test |   | test

Replacing [style-tag-value] with visibility:hidden results in:

test |                        | test

这篇关于可见性:隐藏和显示:无有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:可见性:隐藏和显示:无有什么区别?

基础教程推荐