Joseph
Joseph

Reputation: 661

Why isn't my table showing any border?

I'm using a master page and I have a table that I want to show a border around so that it shows around each cell in the table. Here's the code I'm trying to put a border around:

<table class="mainTable" style="border-color:#DDDDDD;">
    <tr>
        <td class="masterBannerTop" colspan="6" >
            <a href="Default.aspx"><img style="border: none; display: block; margin: 0 auto;" alt="Travel Joan's Blog Banner" src="Website%20Photos/HeadBanner.jpg" /></a>
        </td>     
    </tr>
    <tr>
    <td class="masterBannerNav"><a href="Default.aspx">HOME</a></td>
    <td class="masterBannerNav"><a href="About.aspx">ABOUT ME</a></td>
    <td>

... And it goes on from there. Here's the CSS:

.mainTable
    {
        width: 90%;
        margin-left: 5%;
        margin-right: 5%;
        border-spacing: 30px;
        border-color:#999999;
    }

No matter what color I put in, it doesn't work in any of the browsers. I mean, there's only a couple places where I can put the color. Even if i try to use just CSS or in-line style elements, it still doesn't seem to want to work.

Upvotes: 1

Views: 3058

Answers (4)

CommanderHK
CommanderHK

Reputation: 1138

Do

<table border="1"> ... </table> 

to get borders around your table and between cells.

Do

<table style="border:'1px solid #DDDDDD'"> ... </table>

or

.mainTable {
    border:'1px solid #DDDDDD';
    ...
}

or

.mainTable {
    border-size:1px;
    border-style:solid;
    ...
}

to get borders around your table.

Upvotes: 0

Josh Wa
Josh Wa

Reputation: 1049

Perhaps also make sure you set border-width: 1px or something along those lines?

Upvotes: 1

aet
aet

Reputation: 7292

style="border: 1px solid black"

Upvotes: 1

blackeyebeefhorsefly
blackeyebeefhorsefly

Reputation: 1949

try setting

border:1px solid #999999;

in your css instead of fiddling around with table attributes! Try to avoid using these attributes because it makes changing the style of your site more difficult and the code more verbose for people that have to maintain it. Good luck and let me know how it goes :)

Upvotes: 1

Related Questions