According to w3, the border attribute is available for tables. It accepts a value in px
units. It can be used to set border to a table. The greater the value, the thicker the border. If we set the value of this attribute to 0, then the table will have no border. There is no default value for this attribute.
It can accept any value, not just 50. When you used 50%
as the value, it ignored the % and set a border of 50px to the table.
However, we don't have any control over the style of the border created using border
attribute. This is why we should use the css border
property to set borders because we can customize the appearance of the border.
Here is a snippet for your reference -
<!--No unit, just the value-->
<table border="50">
<tr>
<td>Hello</td>
<td>Hello</td>
</tr>
<tr>
<td>Hello</td>
<td>Hello</td>
</tr>
</table>
<!--Same here. It ignores % and sets a border of 50px-->
<table border="50%">
<tr>
<td>Hello</td>
<td>Hello</td>
</tr>
<tr>
<td>Hello</td>
<td>Hello</td>
</tr>
</table>
<!--It can have any value-->
<table border="15">
<tr>
<td>Hello</td>
<td>Hello</td>
</tr>
<tr>
<td>Hello</td>
<td>Hello</td>
</tr>
</table>
<!--If its value is set to 0, then table will not have any border-->
<table border="0">
<tr>
<td>Hello</td>
<td>Hello</td>
</tr>
<tr>
<td>Hello</td>
<td>Hello</td>
</tr>
</table>
border
attribute (not to be confused with theborder
CSS style) can only be set in pixels and doesn't use a unit specifier. The%
is ignored.