Gets or sets a value that indicates whether and how the object is rendered.
display: inline | block | list-item | run-in | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | flex | inline-flex | -ms-grid | -ms-inline-grid | none
Object is rendered as a block element.
Default. Object is rendered as an inline element sized by the dimensions of the content.
Internet Explorer 6 and later. Object is rendered as a block element, and a list-item marker is added.
Object is not rendered.
Object is rendered as tHead. Table header is always displayed before all other rows and row groups, and after any top captions. The header is displayed on each document spanned by a table.
Object is rendered as tFoot. Table footer is always displayed after all other rows and row groups, and before any bottom captions. The footer is displayed on each document spanned by a table.
Object is rendered inline, but the contents of the object are rendered as a block element. Adjacent inline elements are rendered on the same line, space permitting.
Object is rendered as table.
Object is rendered as table within an
Object is rendered as tr.
Object is rendered as tBody. Table body is always displayed after
table-header-groupobjects and before
Object is rendered as col.
Object is rendered as colGroup.
Object is rendered as caption.
run-inbox contains a
blockelement, object is rendered as a block. If not, and the following sibling is a
block(which is neither floating nor absolutely positioned), object is rendered as the first
inline-blockof the sibling. Otherwise, same as
Internet Explorer 10. Specifies a block-level flexible box ("flexbox") container. For more information on flexbox containers, see Flexible Box ("Flexbox") Layout.
Internet Explorer 10. Specifies an inline-level flexible box ("flexbox") container. For more information on flexbox containers, see Flexible Box ("Flexbox") Layout.
Internet Explorer 10. Specifies a block-level Grid element. For more information on grid layout, see Grid Layout.
Internet Explorer 10. Specifies an inline-level Grid element. For more information on grid layout, see Grid Layout.
|Applies To||All elements|
All visible HTML objects are block or inline. For example, a div object is a block element, and a span object is an inline element. Block elements typically start a new line and can contain other block elements and inline elements. Inline elements do not typically start a new line and can contain other inline elements or data. Changing the values for the display property affects the layout of the surrounding content by:
- Adding a new line after the element with the value block.
- Removing a line from the element with the value inline.
- Hiding the data for the element with the value none.
In contrast to the visibility property, display:none reserves no space for the object on the screen.
In Microsoft Internet Explorer 4.0, the block, inline, and list-item values are not supported explicitly, but do render the element.
The block and inline values are supported explicitly as of Microsoft Internet Explorer 5.
In Microsoft Internet Explorer 5.5 and earlier, the default value of this property for li elements is block.
The inline-block value is supported starting with Internet Explorer 5.5. You can use this value to give an object a layout without specifying the object's height or width.
Starting with Internet Explorer 8, the
table display styles allow elements to closely parallel the visual layout of a table. The Cascading Style Sheets (CSS) table display model does not require explicit elements to correspond with the HTML tags. For example, an element styled as display:table-cell does not need to be contained within a block that is styled display:table-row to be styled correctly. Implicit table elements are created as necessary in an attempt to make the document valid. Contrast this behavior to the traditional HTML table model, where table elements are implicitly closed early to avoid unexpected nesting.
As of Internet Explorer for Windows Phone 8.1 Update and Microsoft Edge, IE supports display:"-webkit-box" as an alias for display:flex and display:"-webkit-inline-box" as an alias for display:inline-flex.
When using display:flex or display:"-webkit-box", the max-width of flex items is clamped to the available space inside the flex container.
This example shows the effect of changing the values for the display property between inline, block, and none.
<span id=oSpan> This is a span </span> in a sentence. <p> <input type="button" value="Block" onclick="oSpan.style.display='block'"> :
This example uses function calls to hide and show table rows and cells.