Posts in current category
May 03, 2021 22:00 CSS
Both the CSS display property and the visibility property can be used to hide an element, but the two properties have different definitions, read the following in detail.
The display property sets how an element should be displayed, and the visibility property specifies whether an element should be visible or hidden.
Hiding an element can be done by setting the display property to "none" or by setting the visibility property to "hidden." Note, however, that these two methods produce different results.
Visibility: Hidden can hide an element, but the hidden element still takes up the same amount of space as before it was hidden. That is, the element, while hidden, still affects the layout.
Display:none can hide an element, and the hidden element does not take up any space. That is, not only is the element hidden, but the space that the element originally occupies disappears from the page layout.
A block element is an element that takes up all widths and is a line break before and after.
Examples of block elements:
Inline elements require only the necessary width and do not force line changes.
Examples of inline elements:
You can change the inline element to a block element, and vice versa, to make the page appear to be grouped in a specific way and still follow web standards.
The following example shows the list item as an inline element:
The following example uses the span element as a block element:
the display type of an element depends on how the element is displayed and what kind of element it is. F
or example, an inline element is set to display:block is not allowed to have nested block elements inside it.
This example shows how to display an inline element of an element.
This example shows how to display a block element of an element.
This example shows how to use thecollapse property of a table.