W3C home > Mailing lists > Public > www-style@w3.org > November 2005

Re: [css21] nested body elements (text/html)

From: Anne van Kesteren <annevk@opera.com>
Date: Thu, 03 Nov 2005 23:40:26 +0100
To: "Kelly Miller" <lightsolphoenix@gmail.com>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <op.szorxox564w2qv@id-c0020.oslo.opera.com>

On Thu, 03 Nov 2005 23:34:36 +0100, Kelly Miller  
<lightsolphoenix@gmail.com> wrote:
>> <http://annevankesteren.nl/test/css/legacy/001>
> That's some odd CSS,

Not really sure why the CSS is odd...

> but I BELIEVE that IE and Firefox have it right here (though I suspect  
> the line SHOULD have a green background, but since the document only has  
> one body element...).

No, it has two. One is added through the DOM and when you use the Firefox  
DOM inspector you can see it is there. When you check the DOM for Opera  
you get the same result.

>  When I looked at it in Opera (both 8.5 and 9 Beta), it filled the  
> background with green.  My guess is that means Opera is automatically  
> adding <html> and <body> or something?  I'm somewhat confused about this.

Ah, the HTML is confusing to you. Per the HTML specification most tags are  
optional and the elements are implicitly added based on certain rules. The  
DOM that is generated by browsers for the above mentioned document (on  
which the CSS is applied) looks like this (without text nodes and such):

  - HEAD
    - TITLE
    - STYLE
  - BODY
    - P
    - SCRIPT
    - BODY

So there are really two BODY elements there...

Kind regards,

Anne van Kesteren

Anne van Kesteren
Received on Thursday, 3 November 2005 22:40:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:21 UTC