Re: line height vs. margins

On Aug 1,  5:45pm, Sho Kuwamoto wrote:

> Is there any consensus on where the extra space from line-height
> should be rendered?

Yes. The concensus was formed by the HTML ERB in 1996 and is
contained in the CSS1 specification.

> Let's say I have some text which paginates as follows.
> Let x be the space between paragraphs, and y be the space
> between lines.

> We can safely assume that y' = y + 10px, but what about x' and x''?

x' = x' + 5px
x'' = x'' + 5px

> Netscape seems to stick all the whitespace above the text, so that
> x' = x+10px, and x'' = x.

That is incorrect behaviour.

> Microsoft IE seems to do something
> different, but I can't tell what it is. Perhaps x'=x+5px and x"=x+5px?

If so, that is correct behaviour.

> What *should* it do? On the one hand, we could leave it up to
> the UA, but if the point of CSS is to allow the web author to
> specify layout accurately, it seems that this would be a good
> thing to nail down.

Yes. It is nailed down at
  http://www.w3.org/TR/REC-CSS1#the-height-of-lines

  4.4    The height of lines

  All elements have a 'line-height' property that, in principle, gives
  the total height of a line of text. Space is added above and below
  the text of the line to arrive at that line height. For example, if the
  text is 12pt high and 'line-height' is set to '14pt', an extra space of
  2pt is added, namely 1pt above and 1pt below the line. Empty
  elements influence these calculations just like elements with
  content.

The spec goes on to give more details.

Are you implementing a renderer?


-- 
Chris Lilley, W3C                          [ http://www.w3.org/ ]
Graphics and Fonts Guy            The World Wide Web Consortium
http://www.w3.org/people/chris/              INRIA,  Projet W3C
chris@w3.org                       2004 Rt des Lucioles / BP 93
+33 (0)4 93 65 79 87       06902 Sophia Antipolis Cedex, France

Received on Friday, 1 August 1997 20:44:42 UTC