In this quick tip tutorial, we see how easy it is to add a border to a table HTML element using CSS, in all the different ways.

A close up of a calendar table with black borders Photo by Pixabay on

For this, we simply add the style attribute to the table html tag. The style attribute should have a value like this: border: 1px solid black.

Here’s an implementation with document.write():

document.write("<table style='border: 1px solid black'>");
document.write("<tr><td>one cell</td></tr>");