HTML Blocks

HTML Blocks

In an HTML we can use either the block level elements or the inline elements.

Block level Elements

A block level element creates a block taking all the space of its container or inside which it is has been declared. The block level elements appear having line breaks. For example <p> is a paragraph element that is when used creates a line and the content of it starts with a new line. Other block level elements are:

<p>, <ul>, <ol>, <pre>, <hr>, <dl>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>. <blockquote> and <address> elements also fall in this category of elements.

The DIV element is also considered as block level element.

The DIV element

This element is used as follows:

<DIV>……….. </DIV>

This element can contain HN, P, HR, address, blockquote, form, pre, table, etc. This element can be inside body, blockquote, div, form, td, and th elements. This element takes the attribute Align.

DIV is used to mark the block of document as a group. Then this element is used to specify the properties of this group. The DIV element does not affect the appearance of the HTML document.



The above example will result in:


Inline elements

Unlike the block level elements the inline element does not begin with a new line; that is it flows with the contents in the same line. The example of inline element is sub (subscript) element or sup (superscript) element.