W3C home > Mailing lists > Public > www-style@w3.org > January 2010

Re: [CSS3 Text] request: line-padding

From: Brad Kemper <brad.kemper@gmail.com>
Date: Wed, 20 Jan 2010 08:57:40 -0800
Cc: Kenneth Kufluk <kenneth@kufluk.com>, fantasai <fantasai.lists@inkedblade.net>, www-style@w3.org
Message-Id: <13D9D5E1-9AD9-4050-9EA4-EEC5100B762F@gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>

On Jan 20, 2010, at 5:56 AM, Tab Atkins Jr. wrote:

>> Finally, if each line is 'cloned', I think there should be a
>> CSS-selector for each line.  This would potentially allow for
>> zebra-style colouring.  Admittedly I don't have a use-case in mind for
>> this, but it's an idea.
> 
> The main problem with this is that ::first-line is already pretty
> screwed up and crazy, and we're somewhat reluctant to multiply this
> craziness by introducing an ::nth-line() pseudoclass.  

True that.

> On the other
> hand, formatted code often uses a light zebra striping, so there is an
> existing use-case.

It sounds to me like you are describing a background pattern. Create an image 1px wide, and as tall as two lines of text. Make the top half of the image one color and the bottom half a different color, and repeat it across the whole multi-line block. Use 'background-size' to keep it the height of 2 lines of text (3em in your example), maybe starting with a larger-than-needed image so that it scales well. 

In fact, if done this way, I don't think you would need to mess with a span, you could just put the padding on the whole box. This also gets the last line of the stripe to go all the way across, even if the text doesn't.

Received on Wednesday, 20 January 2010 16:58:18 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:23 GMT