Table width and columns width

K

kris

Hi
I've problem with my table. Here is code:

<TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
<col width="100" align="left">
<col width="100" align="left">
<TBODY>
<TR>
<th>Col1</th>
<th>Col2</th>
</TR>
</TBODY>
</TABLE>

<TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
<col width="100" align="left">
<col width="100" align="left">
<TBODY>
<tr>
<td>Administratorzy</td>
<td>Administratorzy</td>
</tr>
<tr>
<td>Administratorki</td>
<td>Administratorki</td>
</tr>
</TBODY>
</TABLE>

Why two tables have different width? What I can do to fix it? I want this
same width!!

thanks
kris
 
C

C Garrod

There is no COL tag.

Only <TR></TR> Table row and <TD></TD> Table data.

The reason the cells are not the same width is due to the content it is
being pushed against the side of the cell and increasing the set width.

Try this...

<html>
<head><title>Test</title></head>
<body>
<TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="300">

<TBODY>
<TR>
<th>Col1</th>
<th>Col2</th>
</TR>
</TBODY>
</TABLE>

<TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="300">

<TBODY>
<tr>
<td>Administratorzy</td>
<td>Administratorzy</td>
</tr>
<tr>
<td>Administratorki</td>
<td>Administratorki</td>
</tr>
</TBODY>
</TABLE>
</body>
</html>
 
K

kris

U¿ytkownik "C Garrod said:
There is no COL tag.

Only <TR></TR> Table row and <TD></TD> Table data.

The reason the cells are not the same width is due to the content it is
being pushed against the side of the cell and increasing the set width.

Try this...

<TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="300">

But I want, that width my table was allways constant = 200 !!!

kris
 
S

Steve Pugh

kris said:
I've problem with my table. Here is code:

<TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
<col width="100" align="left">
<col width="100" align="left">
<TBODY>
<TR>
<th>Col1</th>
<th>Col2</th>
</TR>
</TBODY>
</TABLE>

That's a funny looking table. Two headings and no data. What are those
<TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
<col width="100" align="left">
<col width="100" align="left">
<TBODY>
<tr>
<td>Administratorzy</td>
<td>Administratorzy</td>
</tr>
<tr>
<td>Administratorki</td>
<td>Administratorki</td>
</tr>
</TBODY>
</TABLE>

Why two tables have different width?

Because the content you've put in the second table is wider than 100px
with no characters that are permitted line breaking points. What else
is the browser supposed to do?
What I can do to fix it?

Don't put such large content in there. Of course as you have no
knowledge of the user's font size you can't even tell if a really
short word will fit into 100px.
I want this same width!!

Getting the same width in the two tables would be easy if you combined
them into one table. Although I can't tell what you're real data is
like I might hazard a guess that this would in fact make sense. Are
the <th> elements in the first table actually the headings for the
data in the second table? If so then this should definitely be one
table.

Getting the cells to be exactly 100px is a presentation matter and
thus somethin for CSS. You can use table-layout:fixed; to suggest that
the stated widths override the content, but the results may be hard to
use.

A better idea would be to stop trying to force the content into a set
width and allow the content to determine the width.

Steve
 
K

Kevin Scholl

kris said:
But I want, that width my table was allways constant = 200 !!!

Then you need, to use shorter terms in the cells. :)

--

*** Remove the DELETE from my address to reply ***

======================================================
Kevin Scholl http://www.ksscholl.com
(e-mail address removed)
 
S

Sid Ismail

:
: U¿ytkownik "C Garrod" <[email protected]> napisa³ w wiadomo¶ci
: : > There is no COL tag.
: >
: > Only <TR></TR> Table row and <TD></TD> Table data.
: >
: > The reason the cells are not the same width is due to the content it is
: > being pushed against the side of the cell and increasing the set width.
: >
: > Try this...
: >
: > <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="300">
:
: But I want, that width my table was allways constant = 200 !!!
:
: kris
:


Why do you have two tables? You can TR's in one huge table? URL?

Sid
 
K

kris

Uzytkownik "Sid Ismail said:
Why do you have two tables? You can TR's in one huge table? URL?

in Mozilla this code:
<DIV STYLE="WIDTH: 600px; HEIGHT: 50px; PADDING: 0px; MARGIN: 0px">
<TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="580">
<THEAD>
<TR><th>Column 1</th><th>Column 2</th></TR>
</THEAD>
<TFOOT>
<TR><td colspan="2" align="center">This is footer</td></TR>
</TFOOT>

<TBODY STYLE="overflow:scroll; HEIGHT: 100px;">
<tr><td>cell 1 a</td><td>cell 1 b</td></tr>
<tr><td>cell 2 a</td><td>cell 2 b</td></tr>
<tr><td>cell 3 a</td><td>cell 3 b</td></tr>
<tr><td>cell 4 a</td><td>cell 4 b</td></tr>
<tr><td>cell 5 a</td><td>cell 5 b</td></tr>
<tr><td>cell 6 a</td><td>cell 6 b</td></tr>
<tr><td>cell 7 a</td><td>cell 7 b</td></tr>
<tr><td>cell 8 a</td><td>cell 8 b</td></tr>
<tr><td>cell 9 a</td><td>cell 9 b</td></tr>
<tr><td>cell 10 a</td><td>cell 10 b</td></tr>
</TBODY>
</TABLE>
</DIV>

scrolling body of table, but no in IE
than I try do this function in IE

kris
 
R

rf

kris said:
in Mozilla this code:

<snip code>

That is *not* a good idea. With Mozilla there is no way to scroll that tbody
except with the mouse and the vertical scroll bar. Keyboard arrow and page
up/down keys don't work. Mouse wheel doesn't work. It's worse than an iframe
:)

IMHO IE does a much better job of the table.

Cheers
Richard.
 
M

Mark Parnell

Sometime around Tue, 18 Nov 2003 01:38:18 GMT, rf is reported to have
stated:
IMHO IE does a much better job of the table.

<Picks self up off floor>Did I read that correctly? IE does something
*better* than Mozilla? Reality is crumbling around me!
 
R

rf

Mark Parnell said:
Sometime around Tue, 18 Nov 2003 01:38:18 GMT, rf is reported to have
stated:

<Picks self up off floor>Did I read that correctly? IE does something
*better* than Mozilla? Reality is crumbling around me!

Sometimes a tool that does not support all the new fangled bells and
whistles actually works better than one that does and then scrunches an
entire table up into a 1 inch space with a scroll bar :)

Cheers
Richard.
 
K

kris

U¿ytkownik "rf said:
That is *not* a good idea. With Mozilla there is no way to scroll that tbody
except with the mouse and the vertical scroll bar. Keyboard arrow and page
up/down keys don't work. Mouse wheel doesn't work. It's worse than an
iframe

ok
but IE don't suport to scroling TBODY? why? I read that is standard function
in HTML 3.2.
To do this same function I must use DIV tags (layers) :(

kris
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top