Home > Articles

  • Print
  • + Share This
This chapter is from the book

Troubleshooting

Validation Errors Related to Text

I'm getting validation errors related to text materials. Why?

This might be due to an issue with browser display.

Browsers rely on certain display models to interpret HTML and XHTML. Two such display models are referred to as inline and block. An element that is inline appears within the text itself, and therefore no carriage return is applied by the browser. Examples of inline elements include a, span, and any text formatting such as b, i, and u. Block elements are complete sections after which browsers apply a carriage return automatically. Examples of block elements include all headers, p, div, and table.

Strict forms of markup expect that the author will place all inline elements within a properly described block. This means that text should appear within a header, paragraph, list, or any other block element but should not appear alone. So, in a strict document, the following is incorrect and causes a validation error:

To avoid errors, make sure your text is properly placed within a block element, such as a paragraph:

Interestingly, this problem doesn't occur with transitional DTDs, which do not require adherence to block and inline rules.

Font Use

I want to use the font element and still have valid documents. Is that possible?

You can do so following these DTDs:

  • HTML 4.0 transitional

  • HTML 4.01 transitional

  • XHTML 1.0

You can't use the font element in any strict HTML or XHTML document or with the XHTML 1.1 public DTD. As you are already aware, the use of the font element is highly discouraged in favor of CSS.

  • + Share This
  • 🔖 Save To Your Account