- From: Hakon Lie <howcome@w3.org>
- Date: Sat, 18 May 1996 14:30:26 +0200
- To: Greg Kostello <greg_kostello@digitalstyle.com>
- Cc: www-html@w3.org
Greg Kostello writes: > Question: Is it possible, to set the font size and line height relative to > the browser width? That way, as the user changes the width of the browser, > certain elements could respond by shrinking or enlarging proportionally. No, CSS1 specifies that relative units on the 'font-size' [1] property refer to the font size of the parent element: BLOCKQUOTE { font-size: 80% } /* 80% of parent element's font size */ Some of the other properties refer to the width of the parent element: P { text-indent: 5% } /* 5% of parent element's width */ I.e., percentage values on 'font-size' could have referred to the parent element's width as well, but referring to the parent element's font size seemed more useful. > >Yes. In CSS[1] you can express lenght values in units relative to the > >font size: > > > > P { width: 72em } /* ems, the height of the element's font */ > > Just a nit, as stated, ems is a specification font height. However, em says > nothing about the width of the font, even for mono-spaced fonts. So, by > specifying the width as 72 ems, you will only get 72 characters across for a > mono-spaced font if the width for the font is equivalent to the height > (which is rare). Correct. You will need to know the precise width/height ratio for your font of choice if you want exact control. Also, due to the cascading mechanism, you cannot be sure that your font of choice is the one that will appear on the canvas. I.e., your carefully computed width may turn out to be slightly off. CSS1 intentionally does not offer anyone full/detailed control over the presentation. If you REALLY need such control an image or (in this example) PRE or BR tags may be better solutions. Regards, -h&kon Hakon W Lie, W3C/INRIA, Sophia-Antipolis, France http://www.w3.org/people/howcome howcome@w3.org
Received on Saturday, 18 May 1996 08:30:31 UTC