.:[June 22nd - 22:18 CET/GMT-0500]:.

Tips & Tricks to RFC Compliant (x)HTML

Topics:

Document Types
Embed Flash objects in HTML
Switch pages to SSL (https://)
Embed audio in HTML
Prevent MSIE Browser using Mod Rewrite

Document Types

The Document Type Declaration (DTD) is the single most important line in any HTML document, use it!

All documents must declare which type they are. The declaration must be exact (both in spelling and in case) to have the desired effect, which makes it sometimes difficult. To ease the work, below is a list of recommended declarations that you can use in your Web documents.

Use the following markup as a template to create a new XHTML 1.0 document using a proper DOCTYPE.


	<?xml version="1.0" encoding="utf-8">
	<!DOCTYPE html PUBLIC	"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	  <head>
	   <title>An XHTML 1.0 Strict standard template</title>
	   <meta http-equiv="content-type" content="text/html;charset=utf-8" />
	   <meta http-equiv="Content-Style-Type" content="text/css" />
	  </head>

	  <body>
	   <p> … Your HTML content here … </p>
	  </body>
	 </html>
					

I have listed the most most common DTD's below.

HTML 4.01


	<!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


	<!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


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

See more DTD examples on W3's DTD list

Top

Related pages