display
« 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
allows the display of an element to be turned off; all child elements also have their display turned off. The document is rendered as though the element did not 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> |
inherit
Values
<display-value> can be any of the following values:
-
none
-
Turns 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 thevisibility
property.
inline
- The element generates one or more inline element boxes. block
- The element generates a block element box. inline-block Requires Gecko 1.9
- Introduced in CSS 2.1. The 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). list-item
- The element generates a block box for the content and a separate list-item inline box. compact
- (Unsupported, dropped from the CSS 2.1 standard) run-in
-
Unimplemented
in Gecko/Firefox,
bug 2056.
- If the
run-in
box contains a block box, same asblock
. - If a block box follows the
run-in
box, therun-in
box becomes the first inline box of the block box. - If a inline box follows, the
run-in
box becomes ablock
box.
table
- If the
-
Behaves like the
<table>
HTML element.
inline-table
New in Firefox 3
-
The
inline-table
value does not have a direct mapping in HTML.
table-caption
-
Behaves like the
<caption>
HTML element.
table-column | table-column-group
-
These elements behave like the corresponding
<col>
and<colgroup>
HTML elements.
table-header-group | table-row-group | table-footer-group
-
These elements behave like the corresponding
<thead> | <tbody> | <
tfoot>
HTML elements.
table-row
-
Behaves like the
<tr>
HTML element.
table-cell
-
Behaves like the
<td>
HTML element. - 摘自: https://developer.mozilla.org/en/CSS/display