Add border to a table

Description

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 w w .  j  av  a  2 s.com-->
</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 controled by CSS





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed