By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,493 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,493 IT Pros & Developers. It's quick & easy.

Controlling table width

P: n/a
Hi!

I want to create a table with following fixed width, no matter what
content is inside of the table cells:

100 40 40 (first row with 1 + 2 cells)
100 10 10 10 10 10 10 10 10 (2nd, 3rd, 4th, etc. with 1 + 8 cells)

Thanks for your help

Rudi
Feb 27 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Scripsit Rudi Hausmann:
I want to create a table with following fixed width, no matter what
content is inside of the table cells:

100 40 40 (first row with 1 + 2 cells)
100 10 10 10 10 10 10 10 10 (2nd, 3rd, 4th, etc. with 1 + 8 cells)
Just stop wanting that. Problem solved. If some other problem remains,
please tell what it was. What made you want to use fixed widths on a media
that is by definition and by essence flexible and varying? The canvas width
may vary from zero pixels (e.g., speech browser) to infinity.

Technically, you _can_ create fixed-width tables, though not really in HTML
alone, in the general case. You need CSS, specifically the table-layout:
fixed setting. And then you have the overflow problem, which might be harder
than you expect, though quite possibly you would never see it - just your
visitors would see the consequences, like content omitted without notice. In
your case, you would use <colelements for setting the widths, either via
width="..." attributes or using some simple CSS.

Sketchy example:

<table>
<col class="a">
<col><col><col><col><col><col><col><col>
<tr><td>x</td><td colspan="4">x</td><td colspan="4">x</td></tr>
<tr><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td>
<td>x</td><td>x</td><td>x</td><td>x</td></tr>
</table>

to be used with CSS code

table { table-layout: fixed; }
col.a { width: 100px; }
col { width: 10px; }
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Feb 27 '07 #2

P: n/a
Rudi Hausmann wrote:
Hi!

I want to create a table with following fixed width, no matter what
content is inside of the table cells:

100 40 40 (first row with 1 + 2 cells)
100 10 10 10 10 10 10 10 10 (2nd, 3rd, 4th, etc. with 1 + 8 cells)

Thanks for your help

Rudi
<table>
<tr>
<td width="100"></td>
<td colspan=4></td>
<td colspan=4></td>
</tr>
<tr>
<td></td>
<td width="10"></td>
<td width="10"></td>
<td width="10"></td>
<td width="10"></td>
<td width="10"></td>
<td width="10"></td>
<td width="10"></td>
<td width="10"></td>
</tr>
</table>

Catherine (who broke her teeth on tables)
--
== Not nuts, just a little eccentric ==
http://www.africanbush.co.za
African Bush Tours and Safaris
Feb 27 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.