This property specifies the type of rendering box used for an element. It is a shorthand property for many other display properties.
Overview tableinline
display: block
display: flex
display: grid
display: inherit
display: inline
display: inline-block
display: inline-flex
display: inline-grid
display: inline-list-item
display: list-item
display: none
display: table, inline-table, table-row-group, table-column, table-column-group, table-header-group, table-footer-group, table-row, table-cell, table-caption
Change a span
element from its initial display inline
to display as block-level element.
Some example text
<style>
span {
display: block;
}
</style>
Do not display an element by using display: none;
.
<div>Some example text</div>
<style>
div {
display: none;
}
</style>
Specify the rendering type as block or inline to define how the element will display. Set the element to inherit the rendering values of its parent container:
p.block {
display:block;
}
p.inline {
display:inline;
}
p.inherit {
display:inherit;
}
Mobile-adapt a table, suppressing column headers and re-inserting text next to vertically stacked cells:
@media (max-width:400px) {
table, tr, td, th, tbody { display: block }
thead { display: none }
td::before { font-weight: bold }
td:nth-of-type(1)::before { content: "Column 1: " }
td:nth-of-type(2)::before { content: "Column 2: " }
td:nth-of-type(3)::before { content: "Column 3: " }
td:nth-of-type(4)::before { content: "Column 4: " }
}
Stack generously sized links in mobile interface to extend the touch zone to the full width of the screen:
@media (max-width:400px) {
a[href] {
display: block;
padding: 12px;
border-radius: 12px;
margin: 6px;
text-decoration: none;
color: #000;
background-color: #fff;
background-image: url(/img/nav_icon.png);
background-position: 90% center;
}
}
Notes
Computed value and relationship between display, position, and float
table-column-group, table-header-group,
table-footer-group, table-row, table-cell,
table-caption, inline-block|block|
|others|same as specified|
Table-designated elements
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.
Microsoft Developer Network: Windows Internet Explorer API reference Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4