Thomas said:
Hi,
I want to write a site in XHTML1.0 Strict, but it should - of course - also
work with older browsers who don't know about XML yet. Now I have found
information on that subject, but some of the sources contradict each other
or it is not quite clear what one should do and what not. For example, the
necessity of the <xml>-Prolog
The <xml> prolog is optional but nevertheless highly recommended.
Because it would interfere with the ability to trigger MSIE 6 for
windows to render a page in standards compliant rendering mode, then I
do not include it myself.
, the question of the charset encoding (and
where to specify it) and whether to serve the page as "text/html" or not and
which file extension should be used.
So, how do I do this right?
Greetings,
Thomas
If you're going to write your site in XHTML 1.0 strict, then I recommend
- serve the page as "text/html" so that MSIE 5+ can access and render
the pages without problems
- avoid the xml prolog so that MSIE 6 for windows can be triggered to
render the document in standards compliant rendering mode. This is
important to do because of numerous reasons:
a) MSIE 6 for windows will implement correctly the CSS1 box model among
many other bug fixes and corrections
b) you will greatly minimize cross-browser code; your pages layout will
look more closely the same with other highly compliant W3C web standards
compliant browsers (like Opera 7.x, Mozilla 1.3+, Safari 1.1, Konqueror
3.x, etc.)
c) the pages will be parsed and rendered more quickly
- you can specify the charset encoding in a meta element like
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
and in other ways described by the W3C validator. The best way when the
server is running Apache is via an .htaccess file; you should ask others
about this if you don't know how.
http://www.w3.org/International/O-HTTP-charset.html
http://httpd.apache.org/docs/content-negotiation.html
I recommend you invite - somehow - your visitors using an old browser to
upgrade: there is nothing wrong with this and I deeply believe it is in
their own best interests to upgrade their browsers. E.g. NS 4 users
are using a browser which was designed more than 6 years ago.
You can also adopt a flexible and mixed approach to all this by coding
all your pages in HTML 4.01 strict by making your code as closer and
readier to convert to XHTML 1.0 strict or XHTML 1.1 by
- avoing name attributes in all elements which must not use name
attributes in XHMTL 1.x (like form, a, map, ...etc... elements)
- quoting all attribute values,
- etc.
What's the most important in my mind is to choose a strict definition
because this will trigger standards compliant rendering mode in MSIE 6
where the benefits are important for cross-browser compatibility with
highly compliant browsers (like Opera 7.x, Mozilla 1.3+, NS 7.1, Safari
1.1, etc), speed of parsing and rendering, strict implementation of the
CSS1 box model, etc..
DU