First example with text surrounded by a red border.This example also has multiple lines. To create the example above, the code below is used. In the example below, we have surrounded a paragraph ( ) with a red border.įirst example with text surrounded by a red border.
A border in your HTML pages helps bring attention to a section of text or surround any other HTML element.Īs shown below, a border can be created around any text using HTML and CSS on your web page. Using borders, you can add a box around text, and set the border to nearly any color.