Nate Pet
Nate Pet

Reputation: 46222

html table border

I have the following:

        <table class="floatleft" style="margin-right:1em;margin-bottom:1em;border:4px;">

Although I have a border around the table, no border shows up. Any idea?

Upvotes: 1

Views: 176

Answers (2)

Quentin
Quentin

Reputation: 943108

You have specified border: 4px which means the same as:

border-width: 4px;
border-style: none;
border-color: <the value of the 'color' property>;

… because unspecified values take their initial value in shorthand syntax.

Be explicit about the style and colour:

border: 4px solid black;

(or at least the style, since none will stop any border being visible).

Upvotes: 3

karim79
karim79

Reputation: 342625

Probably because you have a white background and you're not setting a border style and color. Try:

<table class="floatleft" style="margin-right:1em;margin-bottom:1em;border:4px solid red;">
    <tr><td>Hello</td></tr>    
</table>
​

http://jsfiddle.net/karim79/qWLvf/

Upvotes: 1

Related Questions