CSS border

The CSS border property allows you to add borders to HTML elements. You can specify the width, style, and color of the border using this property.

Here is the syntax for the border property:


border: [border-width] [border-style] [border-color];

Let's break down the different parts of the border property:

Let's see some examples of how to use the border property:

Result:
This is a red solid border

In the example above, we have set a border of 2px width, solid style, and red color.

Now, let's create a table with different border properties:

Border Example
border: 1px solid black; 1px solid black
border: 3px dashed blue; 3px dashed blue
border: 5px dotted green; 5px dotted green

By using the border property, you can create visually appealing borders around your HTML elements.