display property
Specifies the element's display type.
With this property, you can set how the element should be rendered. The elements in HTML are mostly 'inline' or 'block' elements.
- An inline element should have floating content on its left and right side, too, but a block element fills the entire line, and nothing can be displayed at its left or right side.
- If an element is a block element, its display type can be changed with the float property, too.
The display property is also very useful in dynamic pages, because it allows the author to show or hide an element.
It is similar to the visibility property, but if you set the display property to 'none', it hides the entire element.
The 'hidden' value for the visibility property means that the contents of the element will be invisible, but the element
stays in its original position and size.
JavaScript page for this property: display. You can find other example(s) there. |
Possible values:
One of the following values:
Object is rendered as a box. | |||||||
Same rendering rules for the child elements as the XUL bulletinboard element. | |||||||
Creates either block or inline boxes, depending on context. | |||||||
Object is rendered as a deck. | |||||||
Object is rendered as a grid. | |||||||
Object is rendered as a grid group. | |||||||
Object is rendered as a grid line. | |||||||
Object is rendered as a groupbox. | |||||||
Deprecated. Use inline-block value instead. Object is rendered as a block box inside an inline box. | |||||||
Object is rendered as a box inside an inline box. | |||||||
Object is rendered as a grid inside an inline box. | |||||||
Object is rendered as a stack inside an inline box. | |||||||
Deprecated. Use inline-table value instead. Object is rendered as a table inside an inline box. | |||||||
Declares content generated before or after a box to be a marker. | |||||||
Object is rendered as a popup. | |||||||
Creates either block or inline boxes, depending on context. | |||||||
Object is rendered as a stack. | |||||||
Object is rendered as a box. | |||||||
Object is rendered as a box inside an inline box. | |||||||
Element is rendered as a block. You are able to change a block element's floating rules with the float property. | |||||||
Creates either block or inline boxes, depending on context. | |||||||
Takes the value of this property from the computed style of the parent element. | |||||||
Default. Element is rendered as an inline box. | |||||||
Object is rendered as a block box inside an inline box. | |||||||
Object is rendered as a table inside an inline box. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the li element. | |||||||
Declares content generated before or after a box to be a marker. | |||||||
Object is not rendered. | |||||||
Equivalent of the default styling of the ruby element. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the ruby base text element. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the ruby base container element. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the ruby text element. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the ruby text container element. Supported in Internet Explorer from version 8. | |||||||
Creates either block or inline boxes, depending on context. Supported in Internet Explorer from version 8. | |||||||
Specifies a block-level table. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the caption element. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the td or th element. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the col element. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the colGroup element. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the tFoot element. | |||||||
Equivalent of the default styling of the tHead element. | |||||||
Equivalent of the default styling of the tr element. Supported in Internet Explorer from version 8. | |||||||
Equivalent of the default styling of the tBody element. Supported in Internet Explorer from version 8. |
Default: inline.
Example HTML code 1:
This example illustrates the use of the display property:
|
||||
<head> <style> .block { display: block; background-color: #CFCFCF; } </style> </head> <body> <p>This is a <b id="aTag" class="block">block</b> and this is an <b>inline</b> element. </p> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, applet, b, bdo, big, blink, blockQuote, body, br, button, caption, center, cite, code, col, colGroup, dd, del, dfn, dir, div, dl, dt, em, embed, fieldSet, font, form, frame, frameSet, H1, H2, H3, H4, H5, H6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, label, legend, li, listing, marquee, menu, nobr, object, ol, optGroup, option, p, plainText, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tBody, td, textArea, tFoot, th, tHead, tr, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments