Question

i've searched and could not find any good explanation on here and on the internet many people outline what document types there are but don't explain how to determine which one would work best for your code....

so my question is how do i know which type of document type to declare in my webpage.....i know the difference between XHTML and HTML, i'm not asking that, i'm asking what type of document type such as:

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

OR

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

an explanation or links would help.....i appreciate it!

Was it helpful?

Solution

You can use which you want, but in HTML 5 is recommend to use this:

<!DOCTYPE html>

OTHER TIPS

What works best for you depends on what your situation is.

If you want your HTML page to work correctly on very very old browsers that don't support <!DOCTYPE html> (and yes, there were such browsers, like Netscape 6) then the strict doctype is really the only possibility.

If you want your HTML page to validate, AND you must, for some reason that you don't want to reveal, use elements like <center> or <font> or <u>, then transitional is the doctype of choice.

However, those are really edge cases, and you should consider forgetting about them. In the majority of cases, <!DOCTYPE html> will do. Don't look to the past; look to the future.

Use:

<!DOCTYPE html>

But if you want to know when or why to use which one, see this page:

http://www.w3.org/QA/2002/04/valid-dtd-list.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top