wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Problem with table inside table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem with table inside table" Watch "Problem with table inside table" New topic
Author

Problem with table inside table

Alicia Logan
Greenhorn

Joined: Aug 24, 2005
Posts: 14
Hi all,

what i'am trying to achieve is creating a look and feel of a thin border line surrounding my inner table. For this, i have created one outer table which encompasses another table in its <td> as shown below:

<table bgcolor="#999999" width="400" border="0" align="center">
<tr>
<td>
<table bgcolor="#CCFF99" width="100%" cellpadding="2">
<tr>
<td></td>
</tr>
</table>
</td>
</tr>
</table>

The outer table has has bgcolor of gray while inner has green. Now can someone help me with the parameters of the inner table so that i have a very thin outer gray line surrounding my inner table. The line now is quite thick and looks bad.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Don't color the inner table green, just color the TD's of the outer table. Then you make the cellspacing for the outer (and only) table =1 and it all looks nice. Hopefully. I've done it like this a few times.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Why don't you just assign a border and avoid using the second table?

Eric
Alicia Logan
Greenhorn

Joined: Aug 24, 2005
Posts: 14
Thanks for the help friends, but i found out the viable solution:

<table width="400" border="0" align="center">
<tr bgcolor="#999999">
<td>
<table bgcolor="#CCFF99" width="100%" cellpadding="2">
<tr>
<td></td>
</tr>
</table>
</td>
</tr>
</table>

Just using the bgcolor attrib for the <TR> of the outer table....this may help you in the future.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6

Tabless way:


Tableless is the way to go.
Eric
Alicia Logan
Greenhorn

Joined: Aug 24, 2005
Posts: 14
Hi Eric,

That was a good suggestion. Just wondering, what is your qualification?

Thanks again
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Tables are meant for tabular data. They are "heavy" on browser rendering. Heavy means they take longer to render due to the way the browser has to handle them.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with table inside table
 
Similar Threads
table cells not aligning
Velocity define #set variable and use in inner #macro
change the border color
reg html tables
jsp:include and c:import combination/nesting