Re: [CSS3 Text] request: line-padding

On 01/19/2010 06:37 AM, Kenneth Kufluk wrote:
> When adding a background to wrapped text, it is not currently possible
> to add padding to the wrapped line endings.
>
> For example:
> <div style="width:100px">
>      <span style="background:blue;line-height:1.5em;padding:0.5em">One
> two three four five six seven eight nine ten.</span>
> </div>
>
> This will show the following text with a blue background:
> One two three
> four five six
> seven eight
> nine ten.
>
> The padding will add extra background-coloured space to the start and
> end of the sentence, shown below as "--":
> --One two three
> four five six
> seven eight
> nine ten.--
>
> I would like to add such padding to every line.
> --One two three--
> --four five six--
> --seven eight--
> --nine ten.--
>
> It would be normal practice to simply add this padding to the
> containing div element, but the blue background will not be shown
> against each line.
> Thus I have no means to achieve this using CSS at present, and I see
> no solution in the working drafts for CSS3.

We had a proposal for this in the older CSS3 Backgrounds and Borders
drafts. If you don't have a border on the inline, and don't need to
preserve the default background image tiling behavior, though, the
current draft defines
   span { box-decoration-break: clone; }
which will put padding at all the breaks.

http://www.w3.org/TR/css3-background/#the-box-decoration-break

~fantasai

Received on Wednesday, 20 January 2010 01:07:21 UTC