Search w3schools.com:

SHARE THIS PAGE

HTML <table> border Attribute

HTML table Reference HTML <table> tag

Example

The following HTML table will be displayed with borders around the table cells:

<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The border attribute is supported in all major browsers.


Definition and Usage

The border attribute specifies if a border should be displayed around the table cells or not.

The value "1" indicates borders should be displayed, and that the table is NOT being used for layout purposes.


Differences Between HTML 4.01 and HTML5

In HTML5, the border attribute is only used to indicate if the table is for layout purposes or not, and the only allowed attribute values are "" or "1".


Syntax

<table border="1">

Attribute Values

Value Description
"" No borders around the table cells (the table could be used for layout purposes)
"1" Add borders around the table cells (the table is NOT being used for layout purposes)


HTML table Reference HTML <table> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]