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

On Thu, 03 Nov 2005 23:34:36 +0100, Kelly Miller  
<> wrote:
>> <>
> 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