Quantcast
Channel: pguides.net » html
Viewing all articles
Browse latest Browse all 10

HTML DOCTYPE

$
0
0

Document Type Declaration


The first thing any HTML document should have is a type declaration. This declaration tells the browser which version of the HTML/XHTML standards your document is going to use. Without such a declaration your HTML is not valid and the browser may interpret it freely.

Now, let’s take a look at what the declarations would look like for the various standards.

The document declaration for XHTML 1.0 Strict is shown below. This is what we suggest using.

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

The document declaration for XHTML 1.1 is shown below. This is the newest version of the standards but it requires to be served with a MIME type application/xhtml+xml which not all browsers understand.

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

The document declaration for XHTML 1.0 Transitional is shown below. This version is a bit more lax and closer to HTML 4.

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

For those of you that wish to use frames, the document declaration for XHTML 1.0 Frameset is:

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

Viewing all articles
Browse latest Browse all 10

Trending Articles