473,394 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Controlling table width

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
2 7398
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: M Katz | last post by:
Hi, I'm using the following to allow dynamic resixing of an image (when the usre presses down on a button): function widthup() { image.width = image.width + 1; width.innerText = image.width;...
10
by: Ian Rastall | last post by:
I get the feeling this was just discussed, so sorry if this is redundant. I want to make my books site XHTML Basic, so it will look good on PDA's. Not knowing what to do, I simply switched...
1
by: ryan.champlin | last post by:
I've created a div tag that has overflow set to scroll in my css file. Now I've embedded a table inside of that div. However, a div always expands to the size of it's container. Here the whole...
1
by: TB | last post by:
Hi All: I have this datagrid where space is very tight, and therefore I have to make sure that everything fits within a fixed screen width regardless of whether I am in list mode or in edit...
3
by: dba56 | last post by:
I have a panel containing textboxes and buttons which I use as a header for a datagrid on a webform. I would like the panel width to match the datagrid width. The datagrid width grows depending...
3
by: leo | last post by:
Hello Guys I have this problem in controlling a text in a Text Area. How can I do that, for example the field size is 200, when it reaches 50 it automatically goes to the next line. Because im...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
1
by: bbcline | last post by:
Hi all, I'm a newbie to the forum and a Javascript beginner, I'd appreciate some help with a drop down box issue. Is it possble to limit the options/attributes in a drop down box based on how the...
1
by: Brit | last post by:
I have an ASP file that retrieves names from an Access database for 4 different categories of membership, which the visitor to the page selects (corporate, institutional, regular, or student). The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.