The display attribute is used a lot in web page layout, and it has many attribute values, but The most commonly used attribute values are block, inline-block, inline and none. Other attribute values are rare. So here we will focus on the usage of these commonly used attribute values;
In css , the display attribute is used to define the type of box that an element should generate. It is often used to convert block elements to inline elements, inline elements to block elements, or block elements/inline elements to inline- block element and inline-block element have both the characteristics of block elements and the characteristics of inline elements.
inline-block: Inline block element, which has the characteristics of block elements and inline elements Features
list-item: Set element to be a list
run-in: Display as a block-level element or inline element depending on context
compact/marker: Already removed from CSS2. Delete
table in 1: Set the element to a block-level table (similar to
), with line breaks before and after the table
inline-table: Set the element to an inline table (similar to < ;table>), there are no line breaks before and after the table
table-row-group: Set the element to a group of one or more rows (similar to
)
table-header-group : similar to tag
table-footer-group: similar to
tag; table-row : similar to
tag
none attribute of display attribute When the attribute value of the display attribute of the value
element is set to none, the element will be hidden and not displayed, and it will be separated from the document flow and will not occupy the web page space; very related: display and css hidden elements Usage notes of visibility attribute
The above is the detailed content of How to use css display attribute. For more information, please follow other related articles on the PHP Chinese website!
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