W3C home > Mailing lists > Public > www-style@w3.org > March 2001

RE: CSS 2: Table Cells and the "line-height" Property

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 28 Mar 2001 16:06:03 -0800 (Pacific Standard Time)
To: Jeffrey Yasskin <jyasskin@appcomp.com>
cc: <www-style@w3.org>
Message-ID: <Pine.WNT.4.31.0103281600070.980-100000@HIXIE.netscape.com>
On Wed, 28 Mar 2001, Jeffrey Yasskin wrote:
> On the image-in-a-table issue:
> Ian, what CSS code would produce an image that completely fills, and
> determines the size of, a table cell? That ought to be Possible, at least,
> even if it's not easy.

There are three ways to do this, depending on exactly what you want:

   td { line-height: 0; }


   img { display: block; }


   img { vertical-align: bottom; }

When you have several images on one line and no text, you want the first
one. When you have only one image or several images but each on a
different line, you want the second one. When your images are bigger than
the font-size, you want the third one.

There are two more options: First, if you are using tables for layout and
really want a backwards-compatible layout, then don't use XHTML or HTML4
Strict -- use a 4.0 Transitional DOCTYPE (without the URI part) and thus
make web browsers use their backwards-compatible rendering system.

If you want to do this the "correct" way then stop using HTML tables for
layout reasons, then use background images and other such CSS mechanisms
to get the effect you want.

Of those five answers, the one I usually give is "display:block".

Ian Hickson                                     )\     _. - ._.)       fL
Netscape, Standards Compliance QA              /. `- '  (  `--'
+1 650 937 6593                                `- , ) -  > ) \
irc.mozilla.org:Hixie _________________________  (.' \) (.' -' __________
Received on Wednesday, 28 March 2001 19:03:47 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:57 UTC