You are here: Re: What's wrong with this HTML (fails validation) ? « HTML « IT news, forums, messages
Re: What's wrong with this HTML (fails validation) ?

Posted by Andy Dingley on 02/14/07 11:18

On 14 Feb, 04:35, rem6...@yahoo.com (robert maas, see http://
tinyurl.com/uh3t) wrote:

> I took a class at De Anza College (in Cupertino, CA),

I don't believe that anyone has ever posted a "college class" to these
newgroups where the teaching was anything _other_ than obsolete and
clueless. Most web tutorials are bad and wrong, but colleges seem to
be right at the bottom of the barrel.

> the instructor emphased strongly that we must **stop** writing our
> Web pages in old HTML that is incompatible with XML,

In fairness to your instructor, there are several things they could
reasonably have said here (and even more they meant) and many of them
are quite reasonable advice.

Yes, it's a good idea to author HTML as "XMl style", but only up to a
point.

SGML has an awful lot of features for clever minimisations. Many of
them (although not all) are also available under HTML. If you're a
parser, or if you're Jukka, then you can use the features. For the
rest of us, the long-winded simplicity of XML-style, where consistency
is valued higher than terseness, leads to more accurate hand-coding.

So close your elements with an end tag. Keep your tagname case
consistently lower-case. Quote your attributes. Don't minimize an
attribute like "selected". However _don't_ use the XML form of the
empty element ( <br /> ) and certainly don't ever use this for an
element like <p> that isn't defined in the DTD as being empty. The
first is a minor error, but <p /> is a major error.

This is quite possibly what your tutor actually said. Unless you
already understand a fair bit about what a DTD is, you can't see the
difference.

> we *are* allowed to liberally use <tag/> or <tag /> when we don't enclose anything.

Don't think about "whether it encloses anything" (current document-
based XML behaviour), think instead about whether the DTD forbids it
from ever enclosing anything (i.e. it's declared as EMPTY by SGML's
DTD-based behaviour)


> avoid all use of the br element whatsoever, using <pre>...</pre> instead whenever I want one or
> more single lines with no rearranging of line breaks.

That's ridiculous. <br> is an inline line-break within a paragraph. If
that's what you mean, then use it. Your code examples are one of the
few cases when <pre> might well be appropriate, but for nealy all HTML
coding purposes it isn't.

> the pre element causes a blank line after each section,

It does no such thing, nor does <p>. It causes the content to be
rendered as a block within a box, and CSS might say that there's some
margin space after this. That's a lot different from there being "a
blank line afterwards". There is no line, there's only space after the
line before.


> Does anybody know a way to avoid that blank line
> after a pre section, and before a paragraph??

Learn some trivial CSS, in particular the use of vertical margins.
Avoid padding at first. Learn about "collapsing margins". http://
brainjar.com might be a good starter.


> That's meaningless. Any < or > by itself is unbalanced brockets,

Wasn't "unbalanced brockets" the guy with the steam loco in Chigley?


> And just that one fix makes it fail validation already!! How do I
> force a line break, **without** a blank line, in the middle of a
> paragraph, in transitional XHTML??

<br />

 

Navigation:

[Reply to this 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

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