[thelist] HTML Formatting/HTML Compliance (Script Tag)
Burhan Khalid
burhankh at hotmail.com
Fri Nov 30 09:24:47 CST 2001
<correction>
In my state of missed sleep, I forgot to correctly state the script tag (as
many of you duly noted). I was testing. :P
The correct versions of the tag(s) are :
<script language="Javascript" type="text/javascript"></script>
OR
<script language="Javascript" type="text/javascript" src="some.js" />
</correction>
Important note about scripting/css in XHTML. If you are going to use inline
scripts/css (as in, not from an external file), and you use uses < or & or
]]> or --, then your document will not validate. You have to escape your
inline scripts withing the <![CDATA[ ]]> tags.
See : http://www.w3.org/TR/xhtml1/#guidelines for more on this.
Also, I think I forgot to mention before, all attributes must be quoted. For
example :
<table width=100> will not validate
<table width="100"> WILL validate.
In addition, make sure you attach the correct DOCTYPE declaration. The most
common one (and the most loose/forgiving) is the transitional DTD. This MUST
be the first line of your HTML document, or your page will NOT validate.
Transitional DOCTYPE! declaration (note line wrap) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
The other DTD's are (note line wraps) :
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd"> (Strict DTD)
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"DTD/xhtml1-frameset.dtd"> (Frameset DTD for use in framed pages)
Many of you XML gurus out there are very familiar with its syntax. In
addition to the DOCTYPE, its also recommended that you give a xmlns
attribute in your <html> tag (as per example) :
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Of course, you can change the xml:lang="en" to any other valid language
identifier. Note that the xml:lang attribute takes precidence over the
lang=.
For a list of character sets (ie. lang="") commonly used, see :
http://www.w3.org/International/O-charset-lang.html
I hope this helps someone, and thanks for getting on top of the wrong
information. If you need help with converting your HTML to XHTML, or you
can't seem to figure out why the validator won't ... err ... validate, send
me an email (offlist, if you like), and I'll be happy to look into it for
you.
And now, back to my sleep,
Burhan Khalid
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
More information about the thelist
mailing list