W3C home > Mailing lists > Public > www-style@w3.org > March 2008

RE: [css2.1] :first-line behvior

From: Sergey Malkin <sergeym@windows.microsoft.com>
Date: Wed, 19 Mar 2008 14:05:02 -0700
To: David Hyatt <hyatt@apple.com>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <E30895F8BA39B6439F5F1AAA1DBBFB52473A54EE1F@NA-EXMSG-W602.wingroup.windeploy.ntdev.microsoft.com>

It is actually much simpler scenario:

   <style>
     p                   {color:green;}
     p:first-line        {color:blue;}
   </style>
   <body style="font-size:48pt;" >
   <div>
      <p>This is long <span style="display:inline-block; ">paragraph that may be broken into several </span> lines.</p>
      <p>This is long <span >paragraph that may be broken into several </span> lines.</p>
   </div>

Even if whole text fit into single line, span remains green in first paragraph and blue is in second.

Thanks,
Sergey

-----Original Message-----
From: David Hyatt [mailto:hyatt@apple.com]
Sent: Wednesday, March 19, 2008 11:39 AM
To: Sergey Malkin
Cc: www-style@w3.org
Subject: Re: [css2.1] :first-line behvior

It's hard for me to tell what behavior in Safari you think is wrong.
Could you elaborate?

dave

On Mar 19, 2008, at 1:32 PM, Sergey Malkin wrote:

>
> Several people already pointed out to me, that "div:first-line span"
> is not valid for CSS and should be ignored. So behavior I expect is
> incorrect, but behavior of Opera and Safari still seems wrong.
>
> Thanks,
> Sergey
>
> -----Original Message-----
> From: www-style-request@w3.org [mailto:www-style-request@w3.org] On
> Behalf Of Sergey Malkin
> Sent: Wednesday, March 19, 2008 10:31 AM
> To: www-style@w3.org
> Subject: RE: [css2.1] :first-line behvior
>
>
> 5.12.1, "The :first-line pseudo element", says that in case of
> nested blocks pseudo elements for all blocks should be nested inside
> innermost block-level element:
>
> <div>
>   <p> Abc </p>
>   <p> Xyz </p>
> </div>
>
> should be processed as
>
> <div>
>   <p><div:first-line><p:first-line>Abc</p:first-line></div:first-
> line></p>
>   <p><p:first-line>Abc</p:first-line></p>
> </div>
>
> In reality, I do not see any browser implementing this, div:first-
> line is ignored. Test case I used was:
>
>   <html>
>   <style>
>     div             {font-family:Verdana;}
>     div:first-line  {font-family:Georgia;}
>     p               {color:green;}
>     p:first-line    {color:blue;}
>   </style>
>   <body>
>      <div><p>This is long paragraph that may be broken into several
> lines.</p></div>
>   </body>
>   </html>
>
> Spec uses "should" for this behavior, and since CSSS1 and CSS2 did
> not specify this case, authors should not rely on this behavior. So,
> should this case just be removed from the spec and left unspecified?
>
> Another interesting case is selecting style like "div:first-line
> span":
>
>   <html>
>   <style>
>     div             {font-family:Verdana;}
>     div:first-line  {font-family:Georgia;}
>     p               {color:green;}
>     p:first-line    {color:blue;}
>     div:first-line span {font-weight:bold;}
>   </style>
>   <body>
>   <div>
>      <p>This is long <span style="display:inline-block">paragraph
> that may be broken into several </span>lines.</p>
>      <p>This is long <span style="display:inline-block">paragraph
> that may be broken into several </span>lines.</p>
>   </div>
>   </body>
>   </html>
>
> Span style works only in Opera and only if span is set to
> display:inline-block, but it will apply this rule to the span even
> if it is on the second line and to both paragraphs. In Safari,
> specifying display:inline-block causes p:first-line stop working
> inside this span. Firefox just seems to ignore "div:first-line span"
> style. I would expect bold to appear for the span if it appears on
> first line, either inside inline-block or not, and for the first
> paragraph only. Am I right?
>
> Thanks,
> Sergey
>
>
>
>
>
Received on Wednesday, 19 March 2008 21:05:51 GMT

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