The values of the display attribute in h5 include block, inline, inline-block, none, table, flex, grid, list-item, inherit, initial, etc. Detailed introduction: 1. block, use the block value to make the element display at the block level, that is, the element will occupy an exclusive line, and the width defaults to 100% of the parent container; 2. inline, use the inline value to make the element display inline, that is, the element will not Exclusive line and so on.
The operating system for this tutorial: Windows 10 system, DELL G3 computer.
In HTML5, the display attribute is used to control how elements are displayed. It defines how elements are laid out and presented on the page. The display attribute can take on a variety of values. Some of the common values will be introduced below.
1. block (block-level element): Use the block value to display the element at the block level, that is, the element will occupy an exclusive line, and the width defaults to 100% of the parent container. Common block-level elements include
,
2. inline (inline element): Use the inline value to display the element inline, that is, the element will not occupy a line by itself, but will be displayed in the same line as other elements. Common inline elements include , , , , , etc.
3. inline-block (inline block-level element): Use the inline-block value to display the element in an inline block-level manner, that is, the element is displayed in the same line, and attributes such as width and height can be set. Common inline block-level elements include ,
4. none (hidden element): Use the none value to hide the element, that is, the element will not be displayed on the page. When this value is set, the element will not occupy any space. This is useful when you need to show and hide elements dynamically.
5. table (table element): Use the table value to display the element as a table, that is, the element will have the characteristics of a table, including table rows and columns. Common table elements include
, etc.
6. Flex (flexible layout): Use the flex value to arrange elements using flexible layout. Flexible layout can automatically adjust the size and position of elements according to the size of the container to achieve flexible layout effects. In addition to the above values, the display attribute can also take other values, such as: - grid (grid layout): Use the grid value to arrange elements using grid layout. Grid layout divides the page into rows and columns, making it easy to layout elements. - list-item (list item): Use the list-item value to display elements as list items, that is, there will be a bullet or number in front of the element. - inherit (inherit the display attribute of the parent element): Use the inherit value to inherit the display attribute of the parent element. - initial (initial value): Use the initial value to reset the display property to its initial value. The above are some commonly used display attribute values. By setting the display attribute, we can flexibly control the display mode of elements and achieve various layout effects. The above is the detailed content of What are the values of the display attribute in h5. For more information, please follow other related articles on the PHP Chinese website!
Previous article:What are the disadvantages of display
Next article:What are the fixed positioning methods?
Statement of this 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
Latest Articles by Author
Latest Issues
Keep specific html tags when splitting string
I need to split a string by a specific number of tags (<li>,<lu>...). I came u...
From 2024-03-31 18:12:42
0
1
290
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|