View Full Version : doctypes -- default/best?
djr33
06-05-2006, 11:32 PM
I realize that a doctype is used to offset a "special" encoding, like xml, etc.
However, what I'm not too sure of is what to use for my "normal" sites.
The default, according to w3schools, doesn't allow for all the commands i'm using, but at the same time, they obviously exist.
What's the default/best/normal doctype?
ddadmin
06-05-2006, 11:38 PM
I use the xhtml transitional doctype for the most part, since it's the most realistic one to use right now for normal webpages IMO. It clearly conforms to web standards while still allowing for some essential HTML attributes like "target" of A elements:
<!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" lang="en" xml:lang="en">
djr33
06-05-2006, 11:40 PM
But I don't need xml. I mean... sure, cool thought, but I didn't even think that was allowed in IE.
Is there a more basic one with as much functionality (except xml commands)?
Or would others agree this is the best?
I really don't know... just trying to figure it out.
Thanks.
XHTML Transitional should never be used to design a site. It totally defeats the point of using XHTML in the first place.
XHTML 1.1 Strict is theoretically the best DOCTYPE. Unfortunately, it has several disadvantages (mostly IE's total lack of support and bungling attempts to parse it as HTML) that make it unrealistic. See Sending HTML as text/html Considered Harmful (http://www.hixie.ch/advocacy/xhtml) for more information.
Therefore, HTML 4.01 Strict is really the only DOCTYPE you should be using. There are some cases where XHTML is appropriate, but never send XHTML if IE could be accessing the page, and always send it as application/xhtml+xml.
Oh, and, insofar as I know, functionality has never been removed from a DOCTYPE. If a certain method of accomplishing something has been removed, it's because there is an equivalent. In the case of the "target" attribute, that would be client-side scripting.
djr33
06-07-2006, 03:35 AM
Twey, what would that doctype be, then; the code? (html 4.01)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">Another alternative suggested to me recently is to serve XHTML as application/xml, then construct a stylesheet for it from scratch that replicates what browsers should do. That way, when support grows, all you need do is change the content type and remove the stylesheet, and you'll have a valid, working XHTML page. It's a lot of work though.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.