HTML Code for Table border

What is a Table Border in HTML?

In HTML, a table border is the visible line surrounding the table and its cells. It helps in visually separating the table from the surrounding content and makes it easier to read and understand.

Setting Table Border in HTML

To set the border of a table in HTML, you can use the 'border' attribute within the <table> tag. The value of the 'border' attribute specifies the thickness of the border. For example, <table border='1'> sets a border with a thickness of 1 pixel.

Styling Table Border with CSS

You can also use CSS to style the table border further. This allows for more control over the appearance of the border, including its color, style, and width. The 'border' property in CSS can be applied to table elements to achieve desired border styles.

Example Code

<table border='1'>
    <td>Cell 1</td>
    <td>Cell 2</td>
    <td>Cell 3</td>
    <td>Cell 4</td>

Go from files to website in seconds.

Start a free trial for 7 days — no credit card required

Get Started for Free