w3resource

HTML border attribute

border

The purpose of the HTML border attribute is to set a visible border width for a table.

Supported elements

HTML border attribute supports table element.

Syntax

<table border="value" >.....</table>

Type of value

Type of value of HTML border attribute is pixel.

Value

A width in pixels.

Default value

There is no default value of HTML border attribute.

Supported doctypes

HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.

Example of HTML border attribute with table

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML border attribute with table</title>
</head>
<body>
<table border="1">
<tr>
<td>USA</td>
<td>Washington,D.C.</td>
</tr>
<tr>
<td>UK</td>
<td>London</td>
</tr>
</table>
</body>
</html>

Result

html border attribute with table

View this example in a separate browser window

Example of HTML border attribute with table

Previous: HTML axis attribute
Next: HTML cellpadding attribute