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

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