Wayne Marsh

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromWayne Marsh
ToMe
SubjectPureCSS Menu fix
Date2 July 2005 18:52
I found a fix for your obviously not validated code.

The page in question is:
http://www.howtocreate.co.uk/tutorials/testMenu.html

The problem is that in your examples where you show the code for the HTML
you omitted the ending li tags (</li>)required for each list item.  If you
check the source of the page the HTML is also broken.  If I were you trying
to gives tips on proper codding techniques I'd send all my pages through:
http://validator.w3.org/

I also noticed there is no DOCTYPE declaration.
FromMe
ToWayne Marsh
SubjectRe: PureCSS Menu fix
Date3 July 2005 03:02
Wayne,

Thanks for the "polite" email.

> The problem is that in your examples where you show the code for the HTML
> you omitted the ending li tags (</li>)required for each list item.)

Wrong. In HTML 4 (which is what I use on that page), the closing tag is
optional for LI tags. If I were you, trying to tell web authors that their
code is invalid, I'd read the HTML spec first:
http://www.w3.org/TR/html401/struct/lists.html#h-10.2

The _only_ reason that page fails to validate is the missing doctype (more
on that later):
http://validator.w3.org/check?uri=...testMenu.html&doctype=HTML+4.01+Transitional...

> If I were you trying to gives tips on proper codding techniques I'd send
> all my pages through: http://validator.w3.org/

Congratulations. You have joined the many millions of people who have found
the URL for the W3C HTML validator. I hope you feel uniquely special.

Anyway, sarcasm aside, the W3C HTML validator is a big steaming pile of
monkey manure. It may be able to tell you if you forgot a non-optional
closing tag, or if you mis-encoded an entity, but it has absolutely no
concept of semantics, and will allow any kind of garbage, as long as it uses
valid elements. It does not even have to make sense the way it is used. Just
because it validates, does not make it valid.
http://ln.hixie.ch/?start=1029524973&count=1 - enjoy some light reading.

The validator is not the be-all and end-all. It is only one of many things
that could be considered.

> I also noticed there is no DOCTYPE declaration.

Correct. I do. On many pages. And no, I will not put it in there. I am well
aware of the implications of not including it, and I make an informed
decision. Firstly, I send the pages using the text/html content type, so all
browsers will treat it as HTML (no matter what doctype is used), and for all
of them that understand HTML 4 (virtually all of them), they will treat it
as HTML 4 transitional.

I use some invalid HTML. Deliberately. I use the nobr tag on many of my
pages (though not the one you were talking about). That is not valid, but it
should be. It is a problem with the spec that they leave it out. I need to
define that something is a single word, even if the browsers think it isn't,
and HTML does not offer a way to do that. It offers a way to say what is a
heading, what is a paragraph, but not what is a word. That is HTML's problem
not mine. (And no, CSS wite-space:nowrap; is not good enough because it
fails when CSS is unavailable, and saying something is a word is about
structure, not presentation.)

Since I work with the guy who is writing the HTML 5 spec, I hope to have
that tag put into the spec. If it is, then I will add a HTML 5 doctype.
Until then, I will leave it out and allow the browser to use it - since
virtually all browsers understand nobr (far more than support CSS).

It would also be possible to write my own DTD for HTML or XHTML, but the
HTML spec says not to extend it, and XHTML is not supported by the most
common browser in use, so neither of these is appropriate. And I do not
believe I should have to use these anyway. The element should be in the
spec. The spec is wrong.

Anyway. That just about does it. Next time you want to email, try being a
bit more polite, instead of being all high-and-mighty "woohoo, I just
managed to make an important site look stupid, ain't I kewl!!11111!!!1".
Then you will get a more pleasent response. And try doing your research
first. The specs are publically available.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.