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

RE: CSS 2.1 Block inside inline behaviour

From: Michael Gannon <michael.gannon@blastradius.com>
Date: Fri, 26 Aug 2005 10:46:54 -0700
Message-ID: <A1C50561B5543D45A91A0E5505A79B9802ED5108@luke.radius.ad>
To: "David Woolley" <david@djwhome.demon.co.uk>, <www-style@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:40 GMT