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 Jukka K. Korpela on 02/13/07 06:31

Scripsit Andy Dingley:

> Congratulations! You might be one of the very few people to ever post
> about validation problems here and to have actually exposed a real
> flaw in the validator.

Actually, no. He was however one of the few people who post about validation
problems and provide sufficient information, namely a URL.

> Your code is bogus, although probably not actually invalid.

It is actually invalid; see Rik's answers, or check
http://www.cs.tut.fi/~jkorpela/html/empty.html
(which discusses a more common problem, limited to XHTML-like syntax for
empty elements, where the issue is different - since a validator knows that
an HTML element like <br> has EMPTY declared content, it effectively treats
<br/> just as <br>> without looking for a matching "/").

> It's littered with <p /> <br /> and <hr /> tags.

Yes, that's the practical markup problem, and easy to fix.

> * Your <p> elements aren't empty, so the empty tag <p /> is wrong.

<p /> would be wrong even for an empty paragraph. By HTML rules, "<p /"
starts shorthand markup that will cause a matching "/" to be looked for. By
XML rules, "<p />" is a self-closing element, but the use of that syntax is
disallowed in XHTML that pretends to be compatible with "HTML user agents",
by the infamous Appendix C.

> It seems that the validator recently changed behaviours and started
> accepting <br /> as valid HTML, when it used to reject it outright.

Nope. I don't think there's any change. <br /> is formally valid HTML, it
just _means_ <br>>. It causes no error message. <hr /> might, in Strict HTML
4.01 in a context where only block-level elements are allowed, as directly
inside <body>, but that would be an error due to the ">".

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 

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

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