Home  >  Article  >  Web Front-end  >  What are the values ​​of the display attribute in css

What are the values ​​of the display attribute in css

下次还敢
下次还敢Original
2024-04-26 12:51:15719browse

The display attribute in CSS controls the layout of elements. Its possible values ​​include: 1. Block-level elements: block, inline-block; 2. List items: list-item; 3. Table-related: table, table-caption, table-column-group, table-header-group, table-footer-group, table-row-group, table-cell, table-column, table-row; 4. Inline elements: inline, none ;5. Special values: flex, grid, content

What are the values ​​of the display attribute in css

The value of the display attribute in CSS

display attribute control How elements are laid out on the page. It can take the following values:

Block-level elements:

  • block: The element occupies its own line, occupying the entire available width.
  • inline-block: Similar to inline elements, but allows setting width and height.
  • list-item: Create a list item.
  • table: Create a table.
  • table-caption: Create a table title.
  • table-column-group: Create a table column group.
  • table-header-group: Create a table header group.
  • table-footer-group: Create a table footer group.
  • table-row-group: Create a table row group.
  • table-cell: Create a table cell.
  • table-column: Create a table column.
  • table-row: Create a table row.

Inline elements:

  • Inline: Elements are arranged on the same line as other elements.
  • none: The element is not displayed.

Special values:

  • flex: Creates an element with a flexible layout.
  • grid: Create an element with a grid layout.
  • contents: Display the content of the element, but not the element itself.

The above is the detailed content of What are the values ​​of the display attribute in css. For more information, please follow other related articles on the PHP Chinese website!

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