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

[css3-text] Balance Text proposal

From: Randy Edmunds <redmunds@adobe.com>
Date: Wed, 30 Jan 2013 10:58:09 -0800
To: "www-style@w3.org" <www-style@w3.org>
Message-ID: <EF8190CAE830584B9A075FBE708F5548014A0703E603@NAMBX02.corp.adobe.com>
Hi www-style,

I would like to propose a new value for the text-wrap property: 'text-wrap:balance'

The basic algorithm for rendering text is simple: put as much text as will fit on each line, with the remainder on the last line. This results in the fewest possible lines of text being used, but when a short run text (such as in a title) breaks across two lines the result can sometimes be visually undesirable.

When rendering text that spans multiple lines, this feature provides the option to automatically balance text across the same number of lines.

The intended usage for balance text algorithm is for short text elements such as headings, blockquotes, labels, and captions. When the algorithm is applied to large paragraphs of text, the effort increases and the benefit diminishes, so there may need to be a way to specify a maximum length of text.

As an example, take a title that's a little too wide to fit on one line:

Take a Look at this Balanced

with 'text-wrap:balance' specified, the title would be rendered as:

Take a Look at
this Balanced Text

There's a JavaScript polyfill for this: https://github.com/adobe-webplatform/balance-text

I also describe an algorithm for implementing this : http://adobe-webplatform.github.com/balance-text/proposal/index.html


Randy Edmunds
Received on Wednesday, 30 January 2013 21:54:23 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:23 UTC