You are here: Re: Layout of self-closing divs - can anyone explain this? « HTML « IT news, forums, messages
Re: Layout of self-closing divs - can anyone explain this?

Posted by Ben C on 08/03/07 17:04

On 2007-08-03, David Dorward <dorward@gmail.com> wrote:
> On Aug 3, 4:30 pm, Jeff Dege <jd...@jdege.visi.com> wrote:
>> Now try a third bit of html:
>>
>> <div id="first">
>> <div id="second" />
>> <div id="third" />
>> </div
>>
>> I'd expect this to draw exactly the same as the second example, above.
>> We've made no substantive changes from it. Instead, it draws the same as
>> the first - as if the third div is nested within the second div. Which
>> it isn't, according to everything I thought I understood about how SGML
>> parsing worked.
>
> In HTML <div /> means the same as <div>&gt;.
>
> I believe SGML can cause it to mean the same as <div></div> (and that
> is the case for XML), but the declaration for HTML isn't set up that
> way.

That is the case for XML, but not I think for SGML. It means something
else entirely in SGML but I don't believe that bit of SGML syntax made
it into HTML or if it did no browsers support it anyway.

> Additionally, browsers use tag soup slurpers and not real SGML
> parsers, so <div /> actually gets treated as <div>.

It will get treated as <div></div> if the browser realizes it's dealing
with XML. Whether it gets that from the Content-Type header or from the
doctype, I'm not sure.

 

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

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