Forum Moderators: open

Message Too Old, No Replies

Need help choosing a Doctype

         

Vishal

10:33 pm on Mar 9, 2006 (gmt 0)

10+ Year Member



I am working on setting up a directory within a specific area and am having a small confusion.

Normally I use below doctype (don't really know why):

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

However today my friend recommended me to use below doctype:

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

Now my question is, out of below doctypes which one do you normally use and for what specific reason? Also, if any of the doctype below have any advantage over other one.

1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">

2


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

3


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

4


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

Thank you very much for your help & input.

Vishal

tedster

5:34 am on Mar 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I normally use "none of the above". I don't usually need xml, so either xhtml dtd is just a complication. And transitional doctypes just extends the use of non-standard and deprecated mark-up. So I use HTML 4.01 strict for most new development:

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

ccubed99

7:13 am on Mar 10, 2006 (gmt 0)

10+ Year Member



This is a good explanation of DOCTYPE: and should be of considerable help in choosing which one to use.

Using an incomplete or outdated DOCTYPE—or no DOCTYPE at all—throws these same browsers into “Quirks” mode, where the browser assumes you’ve written old-fashioned, invalid markup and code per the depressing industry norms of the late 1990s.

In this setting, the browser will attempt to parse your page in backward–compatible fashion, rendering your CSS as it might have looked in IE4, and reverting to a proprietary, browser–specific DOM. (IE reverts to the IE DOM; Mozilla and Netscape 6 revert to who knows what.)

If you are using strict then your code should really be 100 percent compliant.