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

Re: Suggestion: A new text attribute to scale the size of text to follow ?the size of a box

From: Brad Kemper <brad.kemper@gmail.com>
Date: Fri, 30 Apr 2010 07:57:51 -0700
Cc: sam <samuelp@iinet.net.au>, Gabriel Zackari <gabriel.zackari@gmail.com>, www-style@w3.org
Message-Id: <3018460E-BDC6-44D8-9FAC-A16E944EFF81@gmail.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>

On Apr 30, 2010, at 6:58 AM, Boris Zbarsky wrote:

> On 4/30/10 6:08 AM, sam wrote:
>> So what is really being asked for is the ability lock a block's
>> font-size to its height: this.font-size = this.height ...
> This isn't doable in general.  Consider this case:
>  <div style="width: 0; font-size: our-magic-value">
>    Some text
>  </div>
> What's the height of the div?

I don't think height alone would be doable. I think if you had 'font-size:fit', it would have to mean something like "shrink or enlarge to fit width, then shrink to fit height if needed". With that model, no automatic wrapping would be allowed (forced wrapping  or PRE would fit the width of the longest line). To make sure the height fit, I think you would have to work backwards from line-height, since line-height can affect the block's height.

> > Very useful when making buttons of different sizes.
> > The text would allways keep to the size of the button.
> As someone who habitually browses with a 13px minimal font size set, I can tell you that people who do this sort of thing right now end up with text in their buttons wrapping and covering up other things...  Makes some websites well-nigh unusable.

Yes, I don't think it would be that good for buttons.
Received on Friday, 30 April 2010 14:58:31 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:45 UTC