<tr bordercolor="">
- Attribute of
- Code Example For Tr In HTML (To Organize Table Rows)
- What does
<tr bordercolor="">
do? - Sets the border color for all inside borders of a table row.
Code Example
<table>
<tr bordercolor="red">
<td>First column</td>
<td>Second column</td>
<td>Third column</td>
</tr>
<tr bordercolor="blue">
<td>First column</td>
<td>Second column</td>
<td>Third column</td>
</tr>
<tr bordercolor="green">
<td>First column</td>
<td>Second column</td>
<td>Third column</td>
</tr>
</table>
First column | Second column | Third column |
First column | Second column | Third column |
First column | Second column | Third column |
Styling Table Border Colors
At one time, the bordercolor
attribute could be used to set the color of the borders appearing between <td>
elements in a table row. However, most modern browsers do not support this attribute any longer. Instead of using HTML attributes to control the styling of table borders, the correct way to style table borders is to use CSS. Our tutorial on styling tables will teach you how to style HTML tables and make sure they render beautifully on a device of any size. To accomplish the effect that was previously achieved with bordercolor
you could use the following CSS styling.
<style> .example-table td:nth-child(n+2) { border-left: 2px solid green; } </style> <table class="example-table"> <tr><td>First column</td><td>Second column</td><td>Third column</td></tr> <tr><td>First column</td><td>Second column</td><td>Third column</td></tr> <tr><td>First column</td><td>Second column</td><td>Third column</td></tr> </table>
What that bit of CSS will do is apply a border to the left side of every td
element beginning with the second element. Here’s how that looks when rendered in the browser:
First column | Second column | Third column |
First column | Second column | Third column |
First column | Second column | Third column |