Adding simple style to HTML Table

Created by
Thursday, July 21, 2016

 

By default HTML tables do not have styling applied. If you add a HTML table to your site and view through a browser you will not see boxes around the borders or cells.

Simple HTML Table

<table border="1">
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>

Now lets add some simple black borders to the table

table,
th,
td {
    border-collapse: collapse;
    border-spacing: 0;
    border: 1px solid #808080
}

by applying this css style to your table you will create a 1px border in solid grey around the elements of your table.

 

0
Rating
1 2 3 4 5

Save

Saved

Report

Reported
Reasons
Cancel
0 comments