You are here: Re: W3C « HTML « IT news, forums, messages
Re: W3C

Posted by cwdjrxyz on 12/23/07 19:48

On Dec 23, 1:19 pm, Steve <php-html-co...@the-grape-vine.c.uk> wrote:
> Ok i am now getting very confused. Initally I was under the opinion that
> then the BR tag was ment to be <br /> to make it W3C compliant. But when I
> use there validator it says it should be <br>.
>
> So it it correct then that <br /> is actually XML and not HTML?
>
> If this is the case then I found hundreds of site out there saying they are
> W3C comliant (HTML 4.01) when they actually are not.
>
> So basically W3C is a load of rubbish as not may are sticking to it?


The self-closed <br /> is an xhtml tag. It is part of xhtml and not
html. The reason is that xhtml must comply with xml rules which are
very strict. An xhtml page could consist of code that could be written
in html only, code that could be written as xml only or a mix.
Everything in xml must be closed. Thus one must use a self-closed tag
such as <br />, <img --- /> for everything that is not closed in an
html page. Not closing anything is a very serious error in xml and can
cause a page not to display in an xml device. Most people who write
xhtml pages do not serve them properly as application/xhtml+xml . You
can serve an xhtml page as the usual mime type text/html, but in that
case you are only serving html and all of the special xhtml code has
no use. Usually a page written in valid xhtml with no xml code will
work mis-served as html. If an xhtml page is served properly, the a
browser capable of true xhtml parses it as xml. Even a tiny error,
such as a non-closed tag, can give an error message rather than a view
of the page. No IE browser, including IE7, can display an xhtml page
when served properly as application/xhtml+xml. If you can view a page
that claimes to be xhtml on any IE browser, then it is not xhtml. The
code may well be written as valid xhtml, but it is being served as
html only. You have to resort to some tricks to get IE and other
outdated browsers to view an xhtml page properly - for instance use
some server side code to serve html 4.01 strict when header exchange
reveals the browser can not support true xhtml.

With this background, the W3C validator is quite right in finding an
error for <br /> on a page written as html and finding an error if
<br> is used on an xhtml page.

 

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

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