Reprence Html CSS javascript PHP MySQL Bootsrap

CSS Display

The display property controls the box's type generated by an element.

CSS Display Property

The CSS specification defines the default display value for all the elements, e.g. the

element is rendered as block, while the element is displayed inline.


Changing the Default Display Value

Overriding the default display value of an element is an important implication of the display property. For example, changing an inline-level element to be displayed as block-level element or changing the block-level element to be displayed as an inline-level element.

The following section describes you the most commonly used CSS display values.


Display Block

The block value of the display property forces an element to behave like block-level element, like a < div> or < p> element. The style rules in the following example displays the < span> and elements as block-level elements:

dsp1

Display Inline

The inline value of the display property causes an element to behave as though it were an inline-level element, like a < span> or an < a> element. The style rules in the following example displays the < p> and < li> elements as inline-level elements:


Display Inline-Block

The inline-block value of the display property causes an element to generate a block box that will be flowed with surrounding content i.e. in the same line as adjacent content. The following style rules displays the < div> and < span> elements as inline-block:


Display None

The value none simply causes an element to generate no boxes at all. Child elements do not generate any boxes either, even if their display property is set to something other than none. The document is rendered as though the element did not exist in the document tree.