Common HTML Mistakes
- Missing or misused alt= attribute in <img> tags.
- "&" should be "&"
- The same ID should not be used for multiple elements in the same document. In other words, any two or more elements on a page may not have the same ID.
- ID's and names can not start with a number.
- Heading levels used out of order. For example, having an <h4> follow an <h1>
- Using a class, such as "heading1", on an element instead of using a proper <h1> (level 1 heading), <h2>, …, <h6> element.
- <center> and <div align="center"></div> are deprecated. Use CSS instead: Centering Elements with CSS.
- Missing DOCTYPE, for example:
<!DOCTYPE html>
and
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
. - Missing <meta> content-type tag, for example:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
In HTML5, you can use the short form:
<meta charset="UTF-8">
- Missing <title> element.
- Misplaced tags that belong in the HTML <head> element. <title>, <meta>, <link>, and <style> elements outside the <head> element; they should be in it.
- Misplaced <head> and <body> tags.
- The HTML height= attribute is not valid for <table> elements; use CSS instead.
- valign="center" should be valign="middle". However, it would be best to use the CSS "vertical-align" property instead.
- Missing action= attribute in <form> tags.
- Misplaced <form> tags. <form> can not be a direct descendant of <table>.
- Problems with <font> tags, that include misplaced or missing end tags. However, since the <font> element is deprecated in favor of CSS, people should really use CSS instead. The <font> element is also considered harmful. (Keep in mind that that article is a very old, so what it says about Netscape 2 and 3 is no longer relevant.)
- <marquee> is a proprietary IE element that has been supported by some other browsers as well for better crossbrowser support. You should not use <marquee>. Instead use JavaScript and provide a way for users to turn the scrolling off.
Related Links:
Last update: 2012-12-19