Display - Property CSS
Summary of characteristics of the display property
block | inline | list-item | run-in | contents | none | flex | grid | ruby | table | flow | flow-root | table-row-group | table-header-group | table-footer-group | table-row | table-cell | table-column-group | table-column | table-caption | ruby-base | ruby-text | ruby-base-container | ruby-text-container | inline-block | inline-flex | inline-grid | inline-tableinlineNot animable: the display property cannot be animated.
(1) Only a few values of display have an effect on an SVG image.
Description of the display property.
display defines how to display an element: as a frame, on the line of text, and so on.
Each HTML element already has a default display mode, but the display property allows you to change this mode.
In practice, it is rare to change the nature of a very specific element, such as an array element but display is particularly
useful in the following cases:
- Make an element disappear (
display:none).. - Declare a
flexcontainer. See the tutorial The flex-box. - Declare a container
grid. See the tutorial grids.
This page is quite long, so use these links to go directly to the display value you're interested in:
block -
contents -
flex -
flow -
flow-root -
grid -
grid-lanes -
inine -
inline-block -
inline-flex -
inline-grid -
inline-grid-lanes -
inline-table -
list-item -
none -
table -
table-caption -
table-cell -
table-column -
table-elements -
table-column-group -
table-header-group -
table-row -
table-row-group -
ruby -
ruby-base -
ruby-text -
ruby-base-container -
ruby-text-container -
run-in
Values for display.
- display: none;
The item will not be displayed at all. The place it would have occupied is available for other elements.
- display: inline;
The item appears on the line of text without causing a line break. The dimensions of the element are defined by its content: it is not possible to change the width or height of an
inlineelement with the CSSwidthandheightproperties.Some HTML elements are displayed by default in
inlinemode: the links a, the input box input, the tag span, etc. img images are also inline elements (which is not obvious).Here's aninline element - display: block;
The element is displayed as a block: it will be preceded and followed by a newline and, unless otherwise specified, it will occupy the entire available width.
Many HTML elements are displayed by default in
blockmode: p paragraphs, titles h1, h2, h3..., div frames, as well as the section, article tags, etc.In the example below, the input tag that is normally of type
inlinehas been changed to ablock: there is a line break before and an after.Your name: - display: inline-block;
The element behaves on the line like an
inlineelement, but its contents are handled as if it were a block: possibility of defining its dimensions, margins, etc. See the example below:The element oppositeIts content is managed like that of an element of theis of theblocktypeinline-blocktype - display: list-item;
The item is displayed as a list item, with a bullet or number. This is the default display mode for li elements.
First item.Second item.Third item. - display: flex;
The element behaves like a
blockelement and is also a flex container for the elements it contains. See the detailed explanations on the The flex-box page.ABC - display: inline-flex;
The element behaves like an
inlineelement and is also a flex container for the elements it contains. See the detailed explanations on the The flex-box page.This element is on a linewhile being a flex container.ABC - display: grid;
The element behaves like a
blockelement and organizes the elements it contains in the form of a grid. See the detailed explanations on the grids page.ABCD - display: inline-grid;
The element behaves like an
inlineelement for its parent, and is a grid container for the elements it contains (arranged in a grid layout).This element is on a linewhile being a grid containerABC - display: grid-lanes; ⚠ display: masonry; ⚠
These two values have the same meaning. The specification provides
grid-lanesbut several browsers have implementedmasonry. It is a grid, but its cells have a fixed dimension only in one direction, defined bygrid-template-columnsorgrid-template-rows.This new feature is still partially implemented (2025). To enable it on your browser:
- Go to the address
about://flagson a Webkit browser, or toabout://configon Firefox. - Search in the search area
masonry. - Set the
CSS.masonry.layoutflag toenabled.
⚠ In the example below, if all the cells in the grid have the same size, it means that your browser does not yet support
masonrygrids.🐠





🐤 - Go to the address
- display: inline-grid-lanes;
The element behaves like an
inlineelement for its parent, and is agrid-lanescontainer for the elements it contains. - display: contents;
The element is not displayed and is further removed from the DOM. In other words, its children (the elements it contains) take its place in the parent/child hierarchy.
For the purposes of the demonstration, we have applied a red background to the parent frame below. This color does not appear because this element has been given the
display:contents;rule.ABC - display: table;
The item is displayed as a table. This is the default display mode for table elements.
In HTML, it is not recommended to use a tag other than table to define tables. Indeed, to display correctly, a table needs very specific internal elements, such as TR lines, TD cells, etc. It is therefore not enough to change the way the container is displayed.
However, in this example, we only used div tags. It was necessary to change their display mode in
tablefor the container, and intable-rowandtable-cellfor the internal elements.ABC - display: inline-table;
The element behaves like an
inlineelement and is also an array container for the elements it contains.This is an element that takes place on a line of text
and behaves like a table for the elements it contains.A B C D E F - display: table-caption; display: table-header-group; display: table-footer-group; display: table-row-group; display: table-row; display: table-column; display: table-column-group; display: table-cell;
All these values correspond to one of the constituents of an array.
table-captionThe title of the table. See also the CSS property caption-sideto position the title relative to the table.
table-header-groupThe header row(s) in a table. This is the default display mode for thead elements. table-footer-groupThe footline(s) of a table. This is the default display mode for tfoot elements. table-row-groupThe row(s) in the body of a table. This is the default display mode for tbody elements. table-rowA table line. This is the default display mode for tr elements. table-columnA table column. This is the default display mode for col elements. table-column-groupA group of table columns. This is the default display mode for colgroup items. table-cellA table cell. This is the default display mode for td elements. - display: ruby;
The element is displayed as a ruby container. In a nutshell, a ruby structure allows a short text to be displayed above each character of a sentence explanation or phonetic information. This presentation is widely used in Japanese, Korean, etc. but we can find other uses for it, as below:
📧 ☎ 📠 📱In HTML it is advisable to use the ruby tag, dedicated to the ruby notation, rather than changing the mode standard tag display This is because the ruby structure needs specific internal elements to display correctly: rb, rt, etc. It is therefore not enough to change the way the container is displayed.
- display: ruby-base; display: ruby-text; display: ruby-base-container; display: ruby-text-container;
Each of these values corresponds to one of the constituents of a ruby structure.
ruby-baseDefault display mode for rb tags. ruby-textDefault display mode for rt tags. ruby-base-containerDefault display mode for rbc tags. ruby-text-containerModDefault display mode for rtc tags. Here are some examples of
rubysyntax. Ruby syntax is normally used with CJK characters, but we preferred to build our examples with graphic characters like a telephone.‹ruby› ‹rb›☎‹/rb› ‹rt›Tel‹/rt› ‹/ruby›☎ ‹ruby› ‹rb›☎‹/rb› ‹rp›(‹/rp›‹rt›Tel‹/rt›‹rp›)‹/rp› ‹/ruby›(2)☎ (1) The rp element is not displayed. It is only useful on browsers that do not support ruby syntax. It designates the characters (often parentheses) that will be used to distinguish the text part (rt).
- display: flow;
Most browsers equate this value with
block. - display: flow-root;
The
flow-rootvalue generates a block container that encloses all of its contents. This solves the problem of a series of elements that have a floating element that may be larger than the text.
L'exemple d'une image flottante à gauche, et suivie d'un texte dont la hauteur est insuffisante pour couvrir la hauteur de l'image.
The next frame shifts to the right of the previous frame.
With display:flow-rootthis problem does not arise.
This image is correctly positioned below the previous one.
- display: run-in; ⚠
The element inserts at the beginning of the element that follows it. This allows for example to keep a title tag, for semantics, while inserting the title at the beginning of the following paragraph.
⚠ Careful! This value is not currently recognized by browsers.
Title
Next paragraph.The result should look like this (simulation):
Title. Next paragraph. - display: initial; (
inline) display: inherit; display: revert; display: revertLayer; display: unset;These values are described in more detail on their respective page:
initial,inherit,revert,revert-layer,unset.
Interactive example with display.
The simulator applies the chosen value to both the container and the four internal elements. The result is not necessarily very significant because some values require a particular construction of the HTML code.
✗ The ms-grid value is only recognized by Internet Explorer, a browser that is now obsolete
Browsers compatibility.
The display property is generally well supported by current browsers for values classics: block, inline, etc.
Some values, such as contents, run-in, still pose compatibility problems.
the display property with most common values.contents value for the display property. run-in value for the display property.clearfix hacking (see float).Notes:
(1) Partial support : severe implementation bugs that renders content inaccessible for many element types.
(2) The buttons are no longer accessible when display:contents is applied.
displayproperty
contentsvalue
run-invalue
flow-rootvalue
Browsers on computers :
Mobile browsers :
Outdated or marginal browsers :

Internet Explorer

KaiOS Browser

Samsung Internet

Androïd Brower

Chrome pour Androïd

Baidu Browser

QQ Browser

Safari

Safari sur IOS

Chrome

Edge

Firefox

Opéra Mobile

UC Browser pour Androïd

Opéra

Firefox pour Androïd

Opéra mini
display property historic.
The display property has been around since the very first version of CSS, but it has undergone quite a few developments to adapt
to new features language, especially flex-box or grid layouts.
-
Cascading Style Sheets specification - Version 1
This first level of the CSS specification describes the mechanism of cascading style sheets. Authors and readers can add styles to documents. Mainly intended for formatting HTML documents, CSS allows defining colors, fonts, text formatting, spacing (margins), etc. The CSS language is easy to understand, readable, and easy to write; it uses common terms from desktop publishing.
Regardingdisplay. Initial property definition, with valuesblock,inline,list-itemandnone.November 17, 1995Working Draft.November 12, 1996Proposed for recommendation.December 17, 1996Recommendation .September 13, 2018Old specification, declared obsolete. -
Cascading Style Sheets Level 2 - Revision 1 Specification
This level 2 of the specification describes the mechanism of cascading styles in CSS. This language is used to format HTML or XML documents. It supports media-specific style sheets so that authors can adapt the presentation of their documents for visual browsers, auditory devices, printers, braille devices, portable devices, etc.
Regardingdisplay. Adding theinline-blockvalue.November 04, 1997Working Draft.March 24, 1998Proposed for recommendation.May 11, 1998Recommendation . -
CSS Ruby Annotation Layout Module Level 1
Regardingdisplay. Adding specific values for Ruby annotations:ruby,ruby-base,ruby-text,ruby-base-containerandruby-text-container.February 16, 2001Working Draft. -
CSS Display Module Level 3
Regardingdisplay. Adding new values.February 20, 2014Working Draft.August 28, 2018Candidate Recommendation.
See also.
The CSS Display Module specification module that describes the display property is very specific.
It includes only a few properties:
Properties:






