Re: [CSS3 Text] request: line-padding

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 UTC