In HTML, you can add a box around text, or a border around text and change it to any color or thickness.

This can be achieved using some CSS.

CSS is applied to HTML elements to alter the look of the elements.

In the below examples, we will see two ways we can add HTML border around text and can colorize it.

 

 

Add HTML Border Around Text Using Inline CSS

You can add inline css to your HTML elements and add a border around your text elements.

Using the style attribute on HTML elements, you can give the border property and add a border.

 

This is an example of a HTML border around some text.

 

Let's look at some HTML code

This is an example of a HTML border around some text.

 

In the above example, we can see that we used the style attribte and used the border styles to add a border around the text.

 

 

Add HTML Border Around Text Using External CSS

The concept remains the same weather you are applying inline CSS or external CSS.

We make use of the CSS border property to assign a border to any element.

 

This is an example of a HTML border around some text using external css.

 

Let's look at some the HTML code for the above

This is an example of a HTML border around some text using external css.