Jump to content
Killersites Community
paulc12@mindspring.com

DOCTYPE Confusion!

Recommended Posts

The more I read about DOCTYPEs the more confusing it seems to me. There are a lot of opinions about it. I am redoing a website, all the html and getting into CSS farther than I ever have. Before I get too many webpages redone I want to determine once and for all which DOCTYPE I should use. I am using Dreamweaver CS4 and noticed if I create a new HTML document using one of the default templates, here is the DOCTYPE that is included;

 

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

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

 

One opinion I read said Dreamweaver plugs in a good DOCTYPE to use. I have no idea whether that is true or not. The website is not going to be super fancy or very technical, I mainly just want solid HTML and CSS. I would like to be able to successfully validate the HTML. So which DOCTYPE does everyone recommend? Is there an agreement on which one would be best? I appreciate any help on this. Thanks.

Share this post


Link to post
Share on other sites

It's a big debate, HTML or XHTML.

 

Here's a lot to read:-

http://www.wickham43.net/generaladvice.php#xhtml

 

A few years ago people thought that XHTML was going to supersede HTML so they converted to XHTML 1.0 but then the people that create these standards decided that XHTML should be "pure" and not used for normal websites, just for special SVG and MathML sites. Pure XHTML with content="application/xhtml+xml" (instead of content="text/html; charset=utf-8") will not display if there is the smallest error and not in IE6 even if correct.

 

Start using HTML 4.01 Strict but if it doesn't validate error-free you may need to use Transitional because certain deprecated tags will still validate with Transitional.

Share this post


Link to post
Share on other sites

You can alter the default Doctype to have it load the HTML 4.01 Strict every time you start a new page by editing the configuration file(s) for Dreamweaver.

 

The following is based on Dreamweaver 8 (outdated) which is what I use to use:

 

Open Windows Explore and navigate to this folder:

 

../Macromedia/Dreamweaver MX/Configuration/DocumentTypes/NewDocuments/

 

If you are using Adobe version then it might read /Adobe/ instead of /Macromedia/

 

Open Default.html using Notepad. You will then be able to see the current Doctype. Just swap it out with HTML 4.01 Strict (copy and paste) and save it.

 

That's it.

 

And it's true that XHTML is going bye-bye but over time. HTML 5 will soon (in a few short years) become the norm if you want to code it using the new tags. Nevertheless, HTML 4.01 will still be a around for years until all modern browsers support the new HTML 5 and CSS 3 and that the old unsupported browser are no longer in extistence.

Share this post


Link to post
Share on other sites

Like Newseed said you can change the Doctype for new documents, in CS4 it is probably the same as in CS3, just go to Preferences - New Document and change the Doctype you want.

Share this post


Link to post
Share on other sites

I been learning with strict for the past while now... yes its good if you really want to drive yourself mad but you learn a lot from it.

 

Validating is brutal but sooner or later you get the hang of it in some way shape or form.

 

Try strict out for a bit then move over to html 4.01. I'm considering 4.01 from now on im thinking.

Share this post


Link to post
Share on other sites

I been learning with strict for the past while now... yes its good if you really want to drive yourself mad but you learn a lot from it.

 

Validating is brutal but sooner or later you get the hang of it in some way shape or form.

 

Try strict out for a bit then move over to html 4.01. I'm considering 4.01 from now on im thinking.

This is the right approach to valid coding. Believe it or not, after doing this for a long while you start to become more proficient and accurate with your coding thus you hardly ever have the need to validate your code.

Share this post


Link to post
Share on other sites

Strict HTML/XHTML is always the best way to go, just provides better looking code if you are true to validating. Or, you could use HTML 5 "<html>" is all you need, that's what I use in my personal site.

Actually, you need <!DOCTYPE html> for HTML 5. Also, keep in mind that many of the new elements/tags that HTML 5 uses are not supported. Google Chrome is the closes thing that will render them. Firefox 3 and Safari seems to support only some of the new tags.

 

Same applies to CSS 3.

Edited by newseed

Share this post


Link to post
Share on other sites

Also keep in mind that HTML 5 and CSS3 are still in beta. Although I don't think they will remove anything that most modern browsers are supporting now, it's possible that new tags or css elements could be added.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×