- From: Manos Batsis <m.batsis@bsnet.gr>
- Date: Mon, 21 May 2001 17:40:32 +0300
- To: <www-style@w3.org>
- Cc: "Ches" <ches@io.com>
You don't need three table cells:
<table style="width:100%;height:100%;text-align:center;border:1px solid
#c0c0c0;">
<tr>
<td style="vertical-align:middle;">
<table style="text-align:left;border:1px solid blue;">
<tr>
<td>test</td>
</tr>
</table>
</td>
</tr>
</table>
The problem is, "vertical-align" can only be applied to (from what I
know of) COL, IMG, SPAN, and TR/TD/TFOOT/THEAD/TBODY.
Regards,
Manos
> -----Original Message-----
> From: Ches [mailto:ches@io.com]
> Sent: Monday, May 21, 2001 4:47 PM
> To: www-style@w3.org
> Subject: Re: CSS to center a table?
>
>
> I have found that nesting tables has produced the centering
> of the table
> effect. This is bad coding however and I would recommend that
> a better way
> of aligning tables independently be found and used. The
> initial table cell
> needs to have something in it, either a blank image that is
> sized to the
> width of your page or some text in order for the nested table
> to center.
>
> <TABLE border="2">
> <tr>
> <td>hhhhhhhhhhhhhhhhhhhhhhh</td>
> </tr>
> <tr>
> <td style="text-align: center">
> <table border="2">
> <tr>
> <td>test</td>
> </tr>
> </TABLE>
> </TD>
> </tr>
> </table>
>
>
> Sincerely,
> Franchesca Havas
> McKinney, Texas
>
> ----- Original Message -----
> From: "Michael D. Crawford (by way of Al Gilman
> <asgilman@iamdigex.net>)"
> <crawford@goingware.com>
> To: <www-style@w3.org>
> Cc: "Michael D. Crawford" <crawford@goingware.com>;
> <fahrner@pobox.com>
> Sent: Saturday, May 19, 2001 10:30 AM
> Subject: CSS to center a table?
>
>
> > [redirected from www-talk -Al]
> >
> > Is there a way to use cascading stylesheets to center a table
> > horizontally on a page?
> >
> > I can give offsets in absolute values or percentages from
> the left or
> > right, but my tables have different widths. I'd like each
> table in my
> > page to be centered no matter how wide or narrow it may be,
> using the
> > same class for such tables.
> >
> > What happens when I try using text-align on the table is
> that the text
> > in the tables cells is centered within the cells. I want
> the cell text
> > to be left justified but for the table to be centered as a whole.
> >
> > (Actually, checking other browsers, in Netscape 4.73 on
> Linux nothing
> > happens, and Mozilla 0.9 on the Mac I get the behaviour I
> describe. I
> > can't get Netscape on the Mac to pick up stylesheets from a
> linked file.
> > Internet Explorer 4.01 on the Mac does what I want. What's
> the deal?)
> >
> > Here's my first attempt:
> >
> > In article.css:
> >
> > <!-- My CSS
> > table.center {text-align: center}
> > -->
> >
> > in my article:
> >
> > <table class="center">
> > <tr><td>Some Text</td></tr>
> > <tr><td>Some Longer Text</td></tr>
> > </table>
> >
> > This comes out like the following, with the text centered
> in the cells:
> >
> >
> > Some Text
> > Some Longer Text
> >
> > What I want is the following, with the text left-justified
> in the cells
> > but the whole table centered:
> >
> > Some Text
> > Some Longer Text
> >
>
>
Received on Monday, 21 May 2001 10:33:59 UTC