In-line and block elements

Some things in HTML are big blocks and some are smaller! It's not quite that easy but the two types are:

For example this paragraph is a block element and runs from the left margin to the right margin of the DIV it is in. By contrast this link (it doesn't lead anywhere!) is only part of a line of text. The paragraph is a block element and the link is an in-line element. The paragraph below has been coloured red to show you that it takes the full width of the DIV it is in even though it is a very short paragraph:

A very short paragraph.

This will become more relevant when you learn CSS.

So what?

Block elements can contain other block elements or in-line elements. You should not put block elements inside in-line elements. In some browsers it may work (sometimes) but it is not supposed to happen.

submit to reddit Delicious Tweet