tags:

views:

1687

answers:

6

I have a simple html table like this: http://jsbin.com/oxiyi

I want to have a border with color #990000 outside the entire table. So I have made a table outside the table and given it border color of #990000. But still I dont see a border color.

+2  A: 

Use a border property with CSS style and give that the color. I got rid of the nested tables in your example as well.

<style>
td {
 border: solid 2px lightgrey;
}
</style>
<table style="border:5px solid #990000;border-collapse;collapse">

http://jsbin.com/odici

That preserves your borders on your cells...

altCognito
but here i miss the lightgreay border color inbetween the different columns...
Alright, I put the borders back, but I used CSS.
altCognito
A: 

I can't tell you exactly why your tables are not interacting correctly without seeing your markup, but I do see a problem with your fundamental approach.

Instead of another table, wrap your table in a DIV tag like this:

<div style="border:solid 1px #990000;"> 
   <your table> 
</div>

This better adheres to modern standards for HTML/XHTML.

Without seeing your code, I can't tell you whether your inner table adheres to best practices or not.

Hope this helps,

Nate

Nathan Southerland
+1  A: 

Probably because the outer table has border set to 0

Change border =0 to border=1

u07ch
+3  A: 

Tables inside tables! Oh noes! My head hurts.

You should be glad that doesn't work, as it is awful markup and should be avoided at all costs. Looking at your HTML code I am noticing a lot of inline properties being set and lack of CSS being used. You should really read up on CSS, as the code you have right now looks more like the code that was being produced in 2000 rather than what we're doing nowadays. In short, however, you can get rid of your outer table and add a style declaration of border: 1px solid #990000; in the table to get the effect you want. This is just the tip of the iceberg, however, and you really should read up on CSS and valid markup before your website self implodes. :)

Paolo Bergantino
+1, I should know better than to facilitate this.
altCognito
CSS oh noesss i'm gonna fall asleep...i know i know. i really should :(
I really want to have no inline css in my tags because it makes me not want to open my html files. however, i've inherited most of this sites code from someone. I am developing some new pages so just copied the content from another page. I'll try my best to have no inline css in this page. But i'll need help. so look out for my questions :)
+2  A: 

A better method would be to remove the outer table and add the border via CSS:

<table ... style='border: 1px solid #900'>

Better still, use an external stylesheet to style the table.

Tyler Rash
+1  A: 

Several problems:

  1. A <div> would be a better tool for this job
  2. Your outer table has bgcolor specified, not bordercolor
  3. Your outer table has border set to 0
  4. You need to also include a <tr> and <td> around the inner table to make your HTML correct

Like this:

<table name='outerTable'>
    <tr>
        <td>
            <table name='innerTable'>
                <tr>
                    <td></td>
                    <td></td>
                </tr>
            </table>
        </td>
    </tr>
</table>
Steven Richards