display | NN 4 IE 4 CSS 1
| Inherited: No
This is a multipurpose attribute that determines how a browser treats invisible boxes that surround every element and text node. For example, a block-level item exhibits specific characteristics that are quite distinct from an inline item (at least with respect to how the element renders in relation to surrounding content). The CSS specification provides numerous types of such boxes, because the space they occupy can be influenced differently by such things as borders or even outright rendering rules (e.g., the way a compact style controls definition list items). In practice, you may not see much, if any, difference between some display types because the browser's built-in style sheet doesn't specify anything different for the variations (e.g., a table element may render the same way if its display style attribute is set to block or table). At the same time, the display style lets you override the default rendering behavior of elements, such as making a block table render as an inline table. Perhaps the most frequently used aspect of the display style attribute in DHTML is setting the scripts to toggle between showing and completely hiding the element and its space. When the attribute is set to none, the element is hidden from view, and all surrounding content cinches up to occupy whatever space the element would normally occupy. This is different from the visibility attribute, which reserves space for the element while hiding it from view. But to redisplay the item to its default display mode, you can assign one of the common display types (block and inline) or the more specific type associated with the element (such as list-item for an li element), if supported by your target browsers.
CSS Syntax
    display: displayType
Value
The CSS specification identifies many display types, but browser support is more limited. The following table shows the supported types.
Display type | IE/Windows | IE/Mac | NN | CSS
--- | --- | --- | --- | ---
block | 5 | 4 | 6 | 2
compact | n/a | n/a | n/a | 2
inline | 5 | 4 | 6 | 2
inline-block | 5.5 | n/a | n/a | n/a
inline-table | n/a | 5 | n/a | 2
list-item | 5 | 5 | 6 | 2
marker | n/a | n/a | n/a | 2
none | 4 | 4 | 6 | 2
run-in | n/a | 5 | n/a | 2
table | n/a | 5 | 6 | 2
table-caption | n/a | 5 | n/a | 2
table-cell | n/a | 5 | 6 | 2
table-column-group | n/a | 5 | n/a | 2
table-footer-group | 5.5 | 5 | 6 | 2
table-header-group | 5 | 5 | 6 | 2
table-row | n/a | 5 | 6 | 2
table-row-group | n/a | 5 | 6 | 2
Initial Value
Element-dependent.
Example
    .hidden {display: none}
Applies To
All elements (but some display types are applicable to specific elements).
Object Model Reference
    [window.]document.getElementById("elementID").style.display