Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 15th, 2005, 06:45 PM
steventhrasher42@hotmail.com
Guest
 
Posts: n/a
Default Table Within Table with colspan and width=100%

I can't figure out a way to possibly make this work in HTML. I have a
table embedded in another table, with the inner table spanning a few
columns. I would like for the outer table to span the width of the
page. The problem is that the 2nd row that contains the colspan'ed
cell with the inner table in it is wider than it needs to be (there's
blank space at the end) which causes the top row to be wider than it
needs to be. Why, and is there a workaround?

Sample HTML follows... Assume the number of columns and widths of
these columns can be variable since the page is generated dynamically.
Also assume I have to have the outer table to keep columns aligned on
consecutive rows.

Thanks!

<HTML>
<BODY>

<TABLE BORDER=1>
<COL>
<COL>
<COL WIDTH=100%>

<TR>
<TD NOWRAP>Outer Table Cell</TD>
<TD NOWRAP>Outer Table Cell</TD>
<TD NOWRAP>Outer Table Cell</TD>
</TR>

<TR>
<TD COLSPAN=3>

<TABLE BORDER=1>

<TR>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
<TD NOWRAP>Inner Table Cell</TD>
</TR>

</TABLE>

</TD>
</TR>

</TABLE>

</BODY>
</HTML>

  #2  
Old August 15th, 2005, 09:05 PM
David Dorward
Guest
 
Posts: n/a
Default Re: Table Within Table with colspan and width=100%

steventhrasher42@hotmail.com wrote:
[color=blue]
> I can't figure out a way to possibly make this work in HTML. I have a
> table embedded in another table[/color]

http://dorward.me.uk/www/nested/
[color=blue]
> Sample HTML follows[/color]
[color=blue]
> <COL>
> <COL>
> <COL WIDTH=100%>[/color]

Well that's invalid (Attribute values may be unquoted if they contain only
certain characters, % isn't one of them).

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

.... and it doesn't make sense anyway. One column uses up ALL the room, yet
there are two more columns.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
  #3  
Old August 26th, 2005, 11:45 AM
Soren Beck
Guest
 
Posts: n/a
Default Re: Table Within Table with colspan and width=100%

steventhrasher42@hotmail.com wrote:[color=blue]
> I can't figure out a way to possibly make this work in HTML. I have a
> table embedded in another table, with the inner table spanning a few
> columns. I would like for the outer table to span the width of the
> page. The problem is that the 2nd row that contains the colspan'ed
> cell with the inner table in it is wider than it needs to be (there's
> blank space at the end) which causes the top row to be wider than it
> needs to be. Why, and is there a workaround?
>
> Sample HTML follows... Assume the number of columns and widths of
> these columns can be variable since the page is generated dynamically.
> Also assume I have to have the outer table to keep columns aligned on
> consecutive rows.
>
> Thanks!
>
> <HTML>
> <BODY>
>
> <TABLE BORDER=1>
> <COL>
> <COL>
> <COL WIDTH=100%>
>
> <TR>
> <TD NOWRAP>Outer Table Cell</TD>
> <TD NOWRAP>Outer Table Cell</TD>
> <TD NOWRAP>Outer Table Cell</TD>
> </TR>
>
> <TR>
> <TD COLSPAN=3>
>
> <TABLE BORDER=1>
>
> <TR>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> <TD NOWRAP>Inner Table Cell</TD>
> </TR>
>
> </TABLE>
>
> </TD>
> </TR>
>
> </TABLE>
>
> </BODY>
> </HTML>
>[/color]

I am not totally sure I understand what you are trying to do, but have
you tried deleting your <col> tags and putting width="100%" as a
parameter on the outer table tag?

--

Søren Beck
Costa Tropical Internet

soren@costatropicalinternet.com
http://www.costatropicalinternet.com

Phone/Fax: +34 958 61 13 89
 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles