Reply to Re: What's wrong with this HTML (fails validation) ?

Your name:

Reply:


Posted by Steve Pugh on 02/16/07 10:03

On Feb 16, 5:54 am, rem6...@yahoo.com (robert maas, see http://
tinyurl.com/uh3t) wrote:
> > From: "Steve Pugh" <steve.gru...@gmail.com>
> > First you need to ask yourself if you are writing XHTML or HTML.
>
> Both.

That's impossible.

> 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.

Either you misunderstood or the instructor was unclear.

> > 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??

That is fine in both.

In HTML </p> is optional. In XHTML it is mandatory. So including it is
okay in both.

But there are other case where the two differ in less compatible ways.

> > 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">

So you are writing HTML. So use HTML syntax.

> > 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?

If you are using the above doctype then you are writing HTML and so
you should use <br>. End of story. You can make your HTML slightly
more XHTML-ish by including all closing tags for non-empty elements
and by quoting all attribute values, but you are still writing HTML so
you must use HTML syntax for empty elements.

> 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?

Write valid HTML 4.01 or XHTML 1.0. 99% of all browsers will cope just
fine with both, now and in the forseeable future.

Steve

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация