|
Posted by robert maas, see http://tinyurl.com/uh3t on 02/16/07 05:54
> From: "Steve Pugh" <steve.gru...@gmail.com>
> First you need to ask yourself if you are writing XHTML or HTML.
Both. The instructor in the "Web Design" class required us to write
HTML/XHTML transitional, so it'd work in existing HTML-based Web
browsers, but also would continue to work with future XML-based Web
browsers. More recently somebody said that's impossible to achieve,
the instructor lied. I'm starting to believe the latter.
> Where and how you close elements varies between the two.
The instructor insisted we write all our Web pages to be consistent
with both. For example, we can't just say <p> between paragraphs.
Instead we must say <p> at start of paragraph and </p> at end of
paragraph. Doesn't that work in both HTML and XHTML??
> So you must be 100% consistent to the rules of whichever one you
> are using. Starting with inclduing either an HTML or XHTML doctype.
The instructor insisted we start every document like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3c.org/TR/html4/loose.dtd">
<html>
<!-- Author: Robert Maas -->
<!-- Date started: 2004.Jun.28 -->
<!-- Just a first test of writing XML-complient HTML file, but with HR -->
<head>
<title>Assignment 1, a simple template
</title>
</head>
<body>
(where the title may vary between various Web pages, but the
doctype and URL for dtd are the same for all documents)
Every document must end like this:
</body>
</html>
However a year or so later somebody complained that my Web pages
done in that way weren't valid HTML because they failed the W3C
validator, so I tried the validator on one of the newer Web pages,
followed the recommedatation given by it, and so for more recent
documents I start them this way instead:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3c.org/TR/html4/loose.dtd">
<html>
<!-- Author: Robert Maas -->
<!-- Date started: 2004.Aug.24 -->
<!-- Linking to the various Hello World! etc. I've written/collected -->
<head>
<meta http-equiv="Content-Type" content="text/html;charset=us-ascii">
<title>Beyond "Hello World"</title>
</head>
<body>
(Again, the actual title varies, but the doctype and URL for dtd
are the same as before, and now the meta http-equiv has been added
and that is now a constant for all new Web pages I write, with
very rare exceptions where I'm trying to absolutely minimize
number of bytes in the file, such as some pages designed for
cellphones where the user is billed in units of 1k bytes so I want
to cram as much as possible into a 1k download.)
> In XHTML use <br /> and in HTML use <br>. That's it. That's how to
> create a valid and working line break in the two languages.
And in transitional HTML/XHTML I can't do either?
How can I write Web pages that work with old browsers, text-only
browsers, brand-new XML-based browsers, etc., rather than work with
this browser but not with that other browser?
Navigation:
[Reply to this message]
|