Things you want to know about websites

 

Doctype and Flavors

Doctype

There are different versions and flavors of Html available. When rendering (running) the markup a broswer needs to know what version or flavor was used to design the page, so that i can run it correctly.

To tell the browser about the version of html we used, we use the Doctype declaration. If you have seen some html documents then you might have noticed the declaration already. It look something like this,

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

It looks a bit cumbursome, but we can understand what it means by first looking at the flavors of html.

Flavors

Both Html and XHTML supports three flavors,

Strict

The Strict type is the most standardized. It doesn't allow the use of depracated or presentational elements. Frames are also not allowed.

Transitional

The Transitional type allows the use of deprecated or presentational elements but frames are not allowed.

Frameset

The Frameset type is same as transitional but allows the use of Frames.

Doctype Declaration

To define a doctype, we use the <!Doctype> tag on the very first line of code.

Example

The doctype for Xhtml with transitional flavor is written as,

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

For other Doctypes you can see Doctype declaration at W3C's website. You don't have to remember this line just copy and paste it with out worrying.

Xhtml Naming Space

If you coding in Html you can just begin by type <html> tag but if you are coding in Xhtml than you should declare a naming space inside <html> tag like,

<html xmlns="http://www.w3.org/1999/xhtml">

You can just copy and paste in every document.


Bookmark or Add to Favourites

Next :

Html-Complete Document Example

Related:

Html-Document Structure
Html-Basic Document Example

Link to this page :

Copy and paste the following code in an html document to link to this page,