⇧
vadnica-logo
Editor My Blog Password Manager Finance My Services About the Project Telegram O meni O meni

CSS Display

The display property is one of the most important CSS properties for controlling the layout of elements on a web page. It is used to determine how an element is displayed in the document flow. Every HTML element has a default value of the display property, depending on the type of element. Most elements have a default value of block or inline.

The display property allows changing the default behavior of HTML elements. A block element ALWAYS starts on a new line and takes up the entire available width. An inline element does NOT start on a new line and takes up only as much width as necessary.

EXAMPLE
RESULT

The CSS property display has many possible values. Let us take a look at them:

Value Description
Block-level Elements
display: block Block element – starts on a new line, takes full width
display: contents Element creates no box; children are "lifted" to its place
display: flexBlock flex container
display: gridBlock grid container
Inline Elements
display: inline Inline element – no line break, only horizontal dimensions apply
display: inline-block Inline box with width/height and margin support
display: inline-flexInline flex container
display: inline-gridInline grid container
display: inline-tableTable at inline level
Table Elements
display: tableBehaves like a table (anonymous boxes for rows/cells)
display: table-captionBehaves like <caption> element in table
display: table-cellBehaves like table cell (<td>)
display: table-columnBehaves like table column (<col>)
display: table-column-groupBehaves like column group (<colgroup>)
display: table-footer-groupBehaves like table footer (<tfoot>)
display: table-header-groupBehaves like table header (<thead>)
display: table-rowBehaves like table row (<tr>)
display: table-row-groupBehaves like table body (<tbody>)
Other / Utility
display: inheritInherits value from parent element
display: initialResets to default value of property
display: list-itemBehaves like list item (with marker)
display: noneElement is not displayed and takes no space