table issue, centered column not possible, when text in other columns

J

joes

Hello

I have strange issue with tables. I like to have table with 3 columns
where the middle column is fixed an the other 2 columns are relative,
using the rest max width. Effect is that the middle area is centered.
So far no issue, Example


<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td width="704">centered column</td>
<td>&nbsp;</td>
</tr>
</table>


When I like to add some text in the first column " T E X T", the
column width is "exploding" so that the centered column moves to right
and the last column is shrinked nearly to nothing.

<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> T E X T </td>
<td width="704">centered column</td>
<td>&nbsp;</td>
</tr>
</table>

I noticed this issue in IE 6.0 and also in FireFox 2. Can anyone
explain what here is happing and why the first and last column are not
longer sharing the rest of the space so that the middle column appears
centered?

Any idea to reach such a design that I can position the " T E X T"
right aligned to the centered column so that when the size of the
browser changes it stills aligned centered?

i.e.

<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="right"> T E X T </td>
<td width="704">centered column</td>
<td>&nbsp;</td>
</tr>
</table>

many thanks in advance

regards
joes
 
D

dorayme

joes said:
Hello

I have strange issue with tables. I like to have table with 3 columns
where the middle column is fixed an the other 2 columns are relative,
using the rest max width. Effect is that the middle area is centered.
So far no issue, Example

<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td width="704">centered column</td>
<td>&nbsp;</td>
</tr>
</table>


Columns mostly have different priorities to us. They listen
foremost to the demands of their contents. Your type of snippet
in more context:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Question</title>
<style type="text/css">
..centreCol {width: 704px;}
</style>
</head>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>A whole lot of words, some big like
antidisestablishmentarianism and other things?</td>
<td class="centreCol">centered column</td>
<td>tiny</td>
</tr>
</table>
</body>
</html>

I have replaced your width instruction with a css one. It is more
correct in this context.

What you see as a default when you have minimal content is not an
indication of what to expect generally. It is not how tables
work.

If you are wanting to layout a webpage rather than exhibit some
relationships as in your average spreadsheet, then there are
quite a few ways to go to get what you want. Google for "3 column
layouts CSS".
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Sat, 01 Sep 2007 19:24:18 GMT
joes scribed:
I have strange issue with tables. I like to have table with 3 columns
where the middle column is fixed an the other 2 columns are relative,
using the rest max width. Effect is that the middle area is centered.
When I like to add some text in the first column " T E X T", the
column width is "exploding" so that the centered column moves to right
and the last column is shrinked nearly to nothing.

You'll never do it with tables. Tables have a mind of their own, even if
you set explicit widths on columns.

The alternative is css. If you're unfamiliar with css, you'll have to
learn the basics, then search for examples of columnar layouts. They're a
bit tricky, but if you _really_ want such a layout, you will prevail.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,998
Messages
2,570,242
Members
46,834
Latest member
vina0631

Latest Threads

Top