RE: CSS 2.1 Block inside inline behaviour

So if I change the HTML to be valid: 

<body>
  <div style="border: 1px solid blue; ">
      <span style="background-color: yellow; color: red">
            Inline text
            <span style="display: block">Block level element</span>
            More inline text
       </span>
  </div>
</body>

Yeah, my real question was CSS related - should the text "Block level
element" have a background colour of yellow?

>From looking at the spec again, it seems that background colour isn't
inherited by default, but it does have an initial value of transparent.
Therefore, the text "Block level element" should have a background of
yellow, no?

Cheers,
Michael.

> -----Original Message-----
> From: www-style-request@w3.org 
> [mailto:www-style-request@w3.org] On Behalf Of David Woolley
> Sent: Thursday, August 25, 2005 23:06
> To: www-style@w3.org
> Subject: Re: CSS 2.1 Block inside inline behaviour
> 
> 
> >       <span style="background-color: yellow; color: red">
> >             Inline text
> >             <div>Block level element</div>
> 
> This is invalid code, so what you are probaby seeing is 
> differences in error recovery.  In particular, what you are 
> probably seeing, in one case, is the parser fixing the code 
> by inserting </span> when it finds the element that is 
> incompatible with its content model, and in the other case, 
> the parse ignoring the content model.
> 
> If you want to test the CSS aspects of this, you need to 
> override the display property of an inline element to be 
> block, not illegally nest a block element in an inline element.
> 
> 

Received on Friday, 26 August 2005 17:47:00 UTC