HTML Tutorial - HTML table borders








The table element defines the border attribute.

Most browsers draws borders around the table and each individual cell.

Example

The following code shows the application of the border element.

<!DOCTYPE HTML>
<html>
<body>
  <table border="1">
    <tbody>
      <tr>
        <th>Favorite:</th>
        <td>A</td>
        <td>G</td>
        <td>M</td>
        <td>500</td>
      </tr>
      <tr>
        <th>2nd Favorite:</th>
        <td>O</td>
        <td>O</td>
        <td>L</td>
        <td>450</td>
      </tr>
    </tbody>
  </table><!-- w  ww.  j  a  v  a2s .  co  m-->
</body>
</html>

Click to view the demo





Note

The value assigned to the border attribute must be 1 or the empty string (""). This attribute doesn't control the style of the border.

The style of the border is controlled by CSS