Forum Moderators: open
We've had a few recent threads which might help guide you:
The best choice depends on whether you are converting existing pages or building new ones. HTML 4.01 Transitional is good first start:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Using a "strict" version will push you towards removing deprecated presentational elements from the markup and use CSS instead, so is generally considered the "best" for new documents:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
I recommend:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
or
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
They give you a place in tomorrow's web design world. Also, I feel you should focus on cross-browser compliance in your designs. Internet Explorer is only one of the many browsers in the field.
But, again, like I said ... XHTML is not properly supported by IE. It works in all other browsers though.
[edited by: DrDoc at 7:28 pm (utc) on April 1, 2006]
An XML declaration is not required in all XML documents; however XHTML document authors are strongly encouraged to use XML declarations in all their documents. Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16 and no encoding was determined by a higher-level protocol.
About content-type ... You may only serve it as text/html if you follow all of these guidelines [w3.org]. More about the XHTML media types can be found here [w3.org]. Important reading, indeed.
Make sure you have read and understand the XHTML documentation [w3.org] before switching over to XHTML, as there are quite a few important differences between XHTML and HTML.
This is especially important with regards to document wellformedness and PCDATA content (such as embedded scripts and stylesheets).
<script type="text/javascript">
<![CDATA[
... unescaped script content ...
]]>
</script>
The only browsers that have XHTML1 support are Mozilla Gecko based, Opera, MSN for OSX, Safari/WebKit, OmniWeb/WebCore, and Konqueror/KHTML. Those support XHTML1 served as XHTML. Internet Explorer has no support for documents served as XHTML on any platform, has no support for the XHTML1 namespace in XML, and has in fact no XHTML1 support at all. It has the HTML tag soup support that Appendix C was targetting only.