Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help

HTML: block and in-line elements

Some types of elements of an HTML document are "block-level" elements and some are "inline" or "text level". "block-level" elements usually begin a new line whereas "inline" elements don't.

If you want to create documents that conform to the latest standards (and are accepted by HTML checkers) you need to be aware that

Consequently you can have <li>test<p>test</p></li> but not <p>test<ul><li>test</li></ul></p>. If you ignore these restrictions an HTML-checker might produce this type of message.


  1. Error Line 135 column 6: document type does not allow element "table" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.
    <table>

    The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

    One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").


You can redefine whether elements are "block-level" or not by changing the value of their display property, but it's rarely a good idea.

For more details see W3C's structure document or their Visual formatting model document.

© Cambridge University Engineering Dept
Information provided by Tim Love (tpl)
Last updated: May 2008