Anonymous 0

What are the things to consider what kind of doctype should be used in a website? I've always used XHTML 1.0 Transitional and I'm slightly aware there are differences semantic differences between doctypes, so I wonder if anyone would shed some light over this particular decision. Thanks!

2 answers

1
point

The primary diferences between Strict and Transitional relate mainly to the formatting elements such as <center>, <font> and <strike> and attributes like nowrap, align and bgcolor. This functionality is allowed in Transitional, but not in Strict and is largely used to help developers make the transition between HTML 4.01 and XHTML 1.0 by making some of those elements available.

That being said, XHTML best practice is to have only functional markup in the .html document and to have all styling located in a stylesheet, so my recommendation would be to move inline with XHTML standards and separate your markup and styling.

There is a 24 Ways article on the differences between the Transitional and Strict doctypes here.

Answered over 4 years ago by Lucas Willett
  • To be a little more clear, the functionality will work no matter the doctype but the doctype is used by the validator for flagging errors on markup that is not valid for its type. In some cases, the doctype will also put the browser into the various modes, quirks, standard and almost standard but never prevents the use of any elements or attributes. Rob over 4 years ago
Rob 230
1
point

When creating new web pages, there is little to question or understand beyond knowing you are to use a strict doctype. New pages should not be using deprecated markup so that throws out every other version. The only decision to be made is whether to use the xhtml or html doctype and that is controversial.

My opinion? Since few, if any of us, actually serve xhtml as xhtml, use the html strict doctype and quit thinking about it. Of course, there's the html5 doctype, too, but I don't know if you want to get into that.

Answered over 4 years ago by Rob
  • I would agree, transitional doctypes were intended to give developers a reprieve while they adjusted to the strict doctype. That was a decade ago (ish) is there any reason to still be using transitional...? danwellman over 4 years ago
  • For new pages, I can't think of one. Rob over 4 years ago