- From: Bert Bos <bert@w3.org>
- Date: Wed, 29 Aug 2007 21:13:14 +0200
- To: www-style@w3.org
On Wednesday 29 August 2007 17:23, fantasai wrote: > Bert Bos wrote: > > O > > Something related that we want in CSS, but haven't quite finished > > designing yet, is a way to make a given text exactly fill a given > > width. We have a proposed > > > > last-line-align: size > > > > whose naming isn't as intuitive as we'd like but which means that > > the UA adjusts the font size so that the text of the block fits > > exactly on one line. Maybe 'text-align: justify; text-justify: > > size' is more intuitive. It's useful for certain headings, e.g. (A > > related addition, 'min-font-size' and 'max-font-size', allows to > > limit the damage.) > > IIRC, Paul and I removed that from CSS3 Text awhile ago. It's was > not a very well-designed feature: for example, it would look very > silly whenever the text was split into more than one line. It's quite common though. You can sort of do it with SVG instead, but then ease of authoring suffers a bit: <h1><object data="ONE-SIZE.svg">One size</object></h1> where ONE-SIZE.svg is an SVG file without an intrinsic size (i.e., no width and height attributes, only a viewbox attribute) that contains the text "ONE SIZE" scaled to the size of the viewbox. However, I think that only works if you hardcode the font in the SVG file.The font cannot depend on the style sheet. Text normally isn't split into multiple lines when you use this, except in extreme cases, when the font size would exceed 'min-font-size' or 'max-font-size'. And typically you wouldn't set 'max-font-size'; and 'min-font-size' won't apply anyway, because the goal is to make text large. <h1>One size</h1> h1 {text-transform: uppercase; last-line-align: size} And actually, I don't think it would look silly when the text is on multiple lines on purpose. On the contrary. <h1>Three<br> different<br> sizes</h1> TTTTTT HH HH RRRRR EEEEEE EEEEEE TT HH HH RR RR EE EE TT HHHHHHH RRRRR EEEE EEEE TT HH HH RR RR EE EE TT HH HH RR RR EEEEEE EEEEEE DD III FFF FFF EEE RRR RRR EEE N N TTT D D I FF FF EE RR RR EE NNN T DD III F F EEE R R R R EEE N N T SSSS IIII ZZZZZZZZ EEEEEE SSSS SS S II ZZ EE SS S SS II ZZ EE SS SSSS II ZZ EEEE SSSS SS II ZZ EE SS S SS II ZZ EE S SS SSSS IIII ZZZZZZ EEEEEE SSSS Looks a bit old-fashioned, 1920's or so, but not silly... Bert -- Bert Bos ( W 3 C ) http://www.w3.org/ http://www.w3.org/people/bos W3C/ERCIM bert@w3.org 2004 Rt des Lucioles / BP 93 +33 (0)4 92 38 76 92 06902 Sophia Antipolis Cedex, France
Received on Wednesday, 29 August 2007 19:13:19 UTC