Table of contents
- 1. Summary
- 2. Syntax
- 3. Specifications
- 4. Browser compatibility
- 5. See also
« CSS « CSS Reference
Summary
The display CSS property specifies the type of rendering box used for an element. In HTML, default display property values are taken from behaviors described in the HTML specifications or from the browser/user default stylesheet. The default value in XML is inline.
In addition to the many different display box types, the value none lets you turn off the display of an element; when you use none, all child elements also have their display turned off. The document is rendered as though the element doesn't exist in the document tree.
- Initial value
:
inline - Applies to: all elements
- Inherited : no
- Media:
visual - Computed value : as specified, except for root element, floated elements, and absolutely positioned elements
Syntax
display: display-value or E.g. display: inline;
display: inherit
Values
display-value
- Is a keyword defining the rendering type to apply to the element. Its possible values and their meanings are:
Value set Value Description Basic values (CSS 1) noneTurns off the display of an element (it has no effect on layout); all child elements also have their display turned off. The document is rendered as though the element did not exist.
To render an element box's dimensions, yet have its contents be invisible, see the
visibilityproperty.inlineThe element generates one or more inline element boxes. blockThe element generates a block element box. list-itemThe element generates a block box for the content and a separate list-item inline box. Extended values (CSS 2.1) inline-blockThe element generates a block element box that will be flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would) Table model values (CSS 2.1) tableBehaves like the <table>HTML element.inline-tableThe inline-tablevalue does not have a direct mapping in HTML.table-captionBehaves like the <caption>HTML element.table-columnThese elements behave like the corresponding <col>HTML elements.table-colgroupThese elements behave like the corresponding <colgroup>HTML elements.table-header-groupThese elements behave like the corresponding <thead>HTML elementstable-row-groupThese elements behave like the corresponding <thead>HTML elementstable-footer-groupThese elements behave like the corresponding <thead>HTML elementstable-rowBehaves like the <tr>HTML elementtable-cellBehaves like the <td>HTML elementFlex box model values (CSS3) Experimental flexboxThe element behaves like a block element and lays out its content according to the flexbox model. inline-flexboxThe element behaves like an inline element and lays out its content according to the flexbox model. Grid box model values (CSS3) Experimental gridThe element behaves like a block element and lay out its content according to the grid model. inline-gridThe element behaves like an inline element and lay out its content according to the grid model. Experimental values Experimental run-in- If the run-in box contains a block box, same as block.
- If a block box follows the run-in box, the run-in box becomes the first inline box of the block box.
- If a inline box follows, the run-in box becomes a block box.
Specifications
| Specification | Status | Comment |
|---|---|---|
| CSS Grid model Level 3 | Working Draft | Added the grid box model values |
| CSS Flexible box model Level 3 | Working Draft | Added the flexible box model values |
| CSS 2.1 | Recommendation | Added the table model values and inline-block. |
| CSS 1 | Recommendation | Basic values: none, block, inline, and list-item. |
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
none, inline and block | 1.0 | 1.0 (1.0) | 4.0 | 7.0 | 1.0 (85) |
inline-block | 1.0 | 3.0 (1.9) | 5.5 (-7.0) natural inline elements only | 7.0 | 1.0 (85) |
list-item | 1.0 | 1.0 (1.0) | 6.0 | 7.0 | 1.0 (85) |
run-in Non-standard | 1.0 Not before inline-elements | -- [1] | 8.0 | 7.0 | 1.0 (85) Not before inline-elements |
| 4.0 | 5.0 (532.5) | ||||
inline-table | 1.0 | 3.0 (1.9) | 8.0 | 7.0 | 1.0 (85) |
table, table-cell, table-column, table-colgroup, table-header-group, table-row-group, table-footer-group, table-row, and table-caption | 1.0 | 1.0 (1.0) | 8.0 | 7.0 | 1.0 (85) |
flexbox Experimental | ? | -- | ? | ? | ? |
inline-flexbox Experimental | ? | -- | ? | ? | ? |
grid Experimental | ? | -- | 10.0 | ? | ? |
inline-grid Experimental | ? | -- | 10.0 | ? | ? |
| Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? |
See also
visibility,float,position


Mozilla Developer Network