Most people easily confuse the CSS properties display and visibility. They seem to be the same, but in fact they are very different.
The visibility attribute is used to determine whether the element is displayed or hidden, which is represented by visibility="visible|hidden" (visible means displayed, hidden means hidden).
When visibility is set to "hidden", although the element is hidden, it still occupies its original position. Example:
Note that when the element is hidden, it can no longer receive other events. , so in the first piece of code, when it is set to "hidden", it can no longer receive response events, so it cannot be displayed by clicking the mouse on the first piece of text.
On the other hand, the display attribute is a little different. The visibility attribute hides the element but maintains its floating position, while display actually sets the floating characteristics of the element.
When display is set to block, all elements in the container will be treated as a single block, just like the
element, which will be placed into the page at that point. (You can actually set the display:block of
so that it works like .
Setting the display to inline will make it behave like the element is inline --- even if it is a normal block element like
, It will also be combined into an output stream like
.
Look at the code and effects of my example below:
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn