Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - Table column width problem

 
Thread Tools Search this Thread
Old 02-10-2005, 09:27 AM   #1
Default Table column width problem


If I specify a border for the table, the specified column width is honored
when displayed in my browser. But I don't understand why the column widths
are not obeyed when the table's border is zero:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder V6.0.2
for Windows">
<META http-equiv="Content-Style-Type" content="text/css">
<TITLE></TITLE>
<BODY>
<DIV align='left'>
<TABLE cellspacing="0" width="100%" cellpadding="0" border="0">
<COL span="1" width="100">
<COL span="1" width="20">
<COL span="1" width="100">
<COL span="1" width="20">
<COL span="1" width="100">
<COL span="1" width="20">
<TBODY>
<TR align="left" bgcolor="#cccccc">
<TD><FONT face="Arial" size="2">Date</FONT></TD>
<TD></TD>
<TD><FONT face="Arial" size="2">Order No.</FONT></TD>
<TD></TD>
<TD><FONT face="Arial" size="2">Payment Ref.</FONT></TD>
<TD></TD>
<TD></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</BODY>

Does anyone know why this happens? Thank you.



--

ELKNews FREE Edition - Empower your News Reader! http://www.atozedsoftware.com


Fernie
  Reply With Quote
Old 02-10-2005, 09:23 PM   #2
mscir
 
Posts: n/a
Default Re: Table column width problem


Fernie wrote:

> If I specify a border for the table, the specified column width is honored
> when displayed in my browser. But I don't understand why the column widths
> are not obeyed when the table's border is zero:

<snip>

I'd get used to validating your code, I like this one:

http://validator.w3.org/

Does this do what you want?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body{
width: 100%;
border: 0;
padding: 0;
margin: 0;
}
..wrapper{
text-align: left;
}
..t1{
border: 0;
padding: 0;
width: 100%;
border-spacing: 0;
}
..td1{
font-family: Arial;
font-size: 90%;
}
</style>
<TITLE>table</TITLE>
</head>

<BODY>
<DIV class='wrapper'>
<TABLE class='t1'>
<COL span="1" width="100">
<COL span="1" width="20">
<COL span="1" width="100">
<COL span="1" width="20">
<COL span="1" width="100">
<COL span="1" width="20">
<TBODY>
<TR align="left" bgcolor="#cccccc">
<TD class='td1'>Date</TD>
<TD>&nbsp;</TD>
<TD class='td1'>Order No.</TD>
<TD>&nbsp;</TD>
<TD class='td1'>Payment Ref.</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</BODY>
</html>
  Reply With Quote
Old 02-16-2005, 02:04 AM   #3
Simon Woodcock
 
Posts: n/a
Default Re: Table column width problem

your column widths are not applied due to the fact that <COL span="1"
width="100"> does not exist. try putting (eg: <td colspan="1"
width="100"> insead of the <COLS... . This should sort your problem.

From
si


Fernie wrote:

> If I specify a border for the table, the specified column width is honored
> when displayed in my browser. But I don't understand why the column widths
> are not obeyed when the table's border is zero:
>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder V6.0.2
> for Windows">
> <META http-equiv="Content-Style-Type" content="text/css">
> <TITLE></TITLE>
> <BODY>
> <DIV align='left'>
> <TABLE cellspacing="0" width="100%" cellpadding="0" border="0">
> <COL span="1" width="100">
> <COL span="1" width="20">
> <COL span="1" width="100">
> <COL span="1" width="20">
> <COL span="1" width="100">
> <COL span="1" width="20">
> <TBODY>
> <TR align="left" bgcolor="#cccccc">
> <TD><FONT face="Arial" size="2">Date</FONT></TD>
> <TD></TD>
> <TD><FONT face="Arial" size="2">Order No.</FONT></TD>
> <TD></TD>
> <TD><FONT face="Arial" size="2">Payment Ref.</FONT></TD>
> <TD></TD>
> <TD></TD>
> </TR>
> </TBODY>
> </TABLE>
> </DIV>
> </BODY>
>
> Does anyone know why this happens? Thank you.
>
>
>
> --
>
> ELKNews FREE Edition - Empower your News Reader! http://www.atozedsoftware.com

  Reply With Quote
Old 02-16-2005, 08:58 AM   #4
Steve Pugh
 
Posts: n/a
Default Re: Table column width problem

Simon Woodcock <> wrote:

>your column widths are not applied due to the fact that <COL span="1"
>width="100"> does not exist.


Hmm, let's see someone who top posted claims that a perfectly legit
HTML construction doesn't exist. I guess that you couldn't be bothered
to check the HTML spec any more than you could be bothered to check
the posting convetion in this newsgroup.

Steve

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

Steve Pugh <> <http://steve.pugh.net/>
  Reply With Quote
Old 02-16-2005, 05:55 PM   #5
Jan Faerber
 
Posts: n/a
Default Re: Table column width problem

Steve Pugh ... output:

> Simon Woodcock <> wrote:
>
>>your column widths are not applied due to the fact that <COL span="1"
>>width="100"> does not exist.

>
> Hmm, let's see someone who top posted claims that a perfectly legit
> HTML construction doesn't exist. I guess that you couldn't be bothered
> to check the HTML spec any more than you could be bothered to check
> the posting convetion in this newsgroup.


urk...

a) <colgroup span="3"> is something different than <col span="3">.
b) When you use <thead>, <tfoot> or <tbody> you have to use them always
together.
c) When you predefine six <col> tags in the <colgroup> section then don't
use seven <td>..</td> pairs in the <tbody>.
d) When a), b) and c) are obeyed then there is no difference when you use
border="0" or ="[>0]".
e) When you use width="100%" or width="700" in the <table> tag then
width="20" and width="100" is relative but if there is no 'width' attribute
in the <table> tag then width="20" or width="100" in the <col> tag is
absolute.

http://html.janfaerber.com/tables/border.lsd



--
Jan

http://html.janfaerber.com
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump