Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set <table> border width with CSS?

Tags:

html

css

Why does this work?

<table border=1> 

And this doesn't?

<table style="border-width:1px;border-color:black"> 

I get the same result in Chrome and in IE9.

like image 563
Buttle Butkus Avatar asked Oct 14 '11 07:10

Buttle Butkus


People also ask

How do you control border-width using CSS?

The syntax for the CSS border-width property (with 2 values) is: border-width: top_bottom left_right; When two values are provided, the first value will apply to the top and bottom of the box. The second value will apply to the left and right sides of the box.

How do you customize a table border?

Go to Table Tools >Design > Table Styles > Borders, and then click the border option that you want to change.


1 Answers

Doing borders on tables with css is a bit more complicated (but not as much, see this jsfiddle as example):

table {    border-collapse: collapse;    border: 1px solid black;  }    table td {    border: 1px solid black;  }
<table>    <tr>      <td>test</td>      <td>test</td>    </tr>  </table>
like image 123
oezi Avatar answered Oct 20 '22 08:10

oezi