Doctype

When you use an element such as a div you are defining a content area, without a doctype Internet Explorer and Gecko browsers render the box model differently with IE applying any padding and border to the inside the content area and Firefox adding them to the outside of the content area.
This effectively makes the offset width and height different in the browsers.

This page is using the following doctype

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

If you view this page in Firefox you will see that Internet Explorer renders the following divs exactly the same as Firefox without the need for conditional statements.

The css applied to this div is

width:200px;
height:100px;
border:1px solid black

The css applied to this div is

width:200px;
height:100px;
border:1px solid black;
padding:10px

You can use document.compatMode to Detect The Render Mode

  1. CSS1Compat = Standards Mode
  2. BackCompat = Quirks Mode
 
Notable points
  • Target attribute not valid for links, see Dom
  • center tag not valid
  • onload in an image tag not valid
  • Action attribute required for forms
  • Type attribute required in style tag
  • Alt attribute for img tag
  • Alt attribute for image map area tag
  • Rows and cols attributes required for textarea
  • Attribute values in quotes
  • document.documentElement instead of document.body
  • Size unit type stated, even in scripting
  • Text must be in a container element such as a P or div etc
  • Anchors must be in a container
  • Image map to have 1 hard coded area tag when dynamically creating, the hard coded tag can be removed by scripting
  • Selectbox must have 1 hard coded option tag, the hard coded tag can be removed by scripting
  • List must have 1 hard coded LI tag, the hard coded tag can be removed by scripting
  • Escape the closing HTML tags forward slash when used with document.write, arrays or scripting

HTML 4.01 Strict, Transitional, Frameset

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
	
	
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
	
	
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

XHTML 1.0 Strict, Transitional, Frameset

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

XHTML 1.1 DTD

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

And then theres the charset

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

This Page Is Valid HTML 4.01 Strict!

Valid HTML 4.01 Strict