Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Table width and columns width

Reply
Thread Tools

Table width and columns width

 
 
kris
Guest
Posts: n/a
 
      11-17-2003
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


 
Reply With Quote
 
 
 
 
C Garrod
Guest
Posts: n/a
 
      11-17-2003
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>

"kris" <(E-Mail Removed)> wrote in message
news:bpau1j$qb0$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
kris
Guest
Posts: n/a
 
      11-17-2003

Użytkownik "C Garrod" <(E-Mail Removed)> napisał w wiadomości
news:bpb0v7$okc$(E-Mail Removed)...
> 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


 
Reply With Quote
 
Owen Jacobson
Guest
Posts: n/a
 
      11-17-2003
C Garrod wrote:

> There is no COL tag.


I would suggest that you read the HTML specification:

<http://www.w3.org/TR/html4/struct/tables.html#h-11.2.4.2>
 
Reply With Quote
 
Steve Pugh
Guest
Posts: n/a
 
      11-17-2003
"kris" <(E-Mail Removed)> wrote:

>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
<th>s supposed to be the headings for?

><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

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
Kevin Scholl
Guest
Posts: n/a
 
      11-18-2003


kris wrote:

>>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 !!!


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

--

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

================================================== ====
Kevin Scholl http://www.ksscholl.com
http://www.velocityreviews.com/forums/(E-Mail Removed)
------------------------------------------------------
Information Architecture, Web Design and Development
------------------------------------------------------
We are the music makers, and we are the dreamers of
the dreams...
================================================== ====

 
Reply With Quote
 
Sid Ismail
Guest
Posts: n/a
 
      11-18-2003
On Mon, 17 Nov 2003 18:50:04 +0100, "kris" <(E-Mail Removed)> wrote:

:
: Użytkownik "C Garrod" <(E-Mail Removed)> napisał w wiadomości
: news:bpb0v7$okc$(E-Mail Removed)...
: > 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

 
Reply With Quote
 
kris
Guest
Posts: n/a
 
      11-18-2003

Uzytkownik "Sid Ismail" <(E-Mail Removed)> napisal w wiadomosci
news:(E-Mail Removed)...
>
> 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


 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      11-18-2003

"kris" <(E-Mail Removed)> wrote in message
news:bpbrm2$o6e$(E-Mail Removed)...
>
> Uzytkownik "Sid Ismail" <(E-Mail Removed)> napisal w wiadomosci
> news:(E-Mail Removed)...
> >
> > Why do you have two tables? You can TR's in one huge table? URL?

>
> 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.


 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      11-18-2003
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!

--
Mark Parnell
http://www.clarkecomputers.com.au
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Align table columns with gridview columns Jacksm ASP .Net 2 11-21-2006 09:49 PM
fixed-width column and variable-width columns mixed ssk HTML 5 10-30-2006 07:50 AM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
converting xml to table width multiple columns by xsl =?iso-8859-1?q?Tobias_M=FCller?= XML 4 09-06-2005 09:41 PM
Re: resized image in table extends table width to original image width Sean Jorden HTML 1 08-19-2003 08:59 AM



Advertisments