Forum Moderators: open

Message Too Old, No Replies

Which doctype?

Adding doctype to old pages.

         

Ian_M

8:40 pm on May 16, 2006 (gmt 0)

10+ Year Member



Most of my web pages were made years ago with Frontpage Express, but recently I have begun updating them with Dreamweaver and using css on them, so they are a mixture of old and new. Most of them don't have a 'doctype', they just begin with <html>. Should I add a doctype to the header? If so, which one should I use? Dreamweaver gives lots to choose from. How do I know which one is appropriate? Would be grateful for any advice.

Robin_reala

9:27 pm on May 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A doctype states which language a page is written. A purist would say that the doctype you should use is the latest it validates in - if it doesn't validate then you're saying it's written in a certain language when it's not :)

In practice, HTML 4.01 transitional would be a good starting point.

Ian_M

9:33 pm on May 16, 2006 (gmt 0)

10+ Year Member



Many thanks. I shall take your advice.

Fotiman

10:09 pm on May 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Note also, if you use a full DOCTYPE, your pages will no longer be displayed in Quirks mode, which can affect your page layout (depending on how you layout your page). So if you add it and find that things suddenly look all out of whack, that would be why.

encyclo

10:06 am on May 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HTML 4.01 Transitional is definitely the most flexible choice, and is best for "converting" old pages. You can try with this doctype first:

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

As Fotiman has said above, that "full" doctype (with an URL pointing to the DTD) changes the rendering mode in modern browsers to a more standards-compliant mode, so if you have problems you can use this instead:

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

The above will ensure the more backwards-compatible "quirks mode". Ideally, you should move to the full doctype over time and correct your page layouts to render well in standards-compliance mode.

mike73

6:32 am on May 19, 2006 (gmt 0)

10+ Year Member



If you want things to look the same in IE and FF use this one:

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

Robin_reala

8:26 am on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mike: a transitional doctype will also tip both IE and Fx into standards compliant mode as well, as long as you've got a system URI. In fact, I'd specifically say not to go for a strict doctype in this case, as if the OP is updating old content it's very unlikely to validate.

mike73

5:28 pm on May 19, 2006 (gmt 0)

10+ Year Member



a transitional doctype will also tip both IE and Fx into standards compliant mode as well, as long as you've got a system URI. In fact, I'd specifically say not to go for a strict doctype in this case, as if the OP is updating old content it's very unlikely to validate.

Funny you should mention that. The reason I was drawn to this topic was because I had just spent 4 hours trying to get one column to be the same width in IE and FF. Everything else was fine, except this one column. Then I switched to the strict doctype, and *BLAM-O* everything worked perfectly.