CSS border

CSS border is used to give the border for html element. This is a shorthand property to give border with a single setting to specify the width, style and color of border. This property will give borders to all the sides of an HTML element.

The syntax for CSS border is:

For Example:

Output

This is the paragraph to show HTML border example. This will give border the all the sides of this div. The color of border is red. This border property has given here to display border.

CSS border values list

The values and description of this property is used for border. This is used to display the border for the HTML element.

Sr. No.valueDescription
1border-widthUsed to give width of border. The value for this is in px. Check CSS border-width for more detail.
2border-styleUsed to give style for border. The value for this can be from none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset. Check CSS border-style for more detail.
3border-colorUsed to give color for border. The value for this can be hex color, rbga() and color label. Check CSS border-color for more detail.
6initialUsed to define as the property initial value.
7inheritUsed to define the computed value of property on the elements parent.

CSS border dotted

In this example we will use to show dotted border-bottom. This is the steling of the border looks like a dash to all the sides.

Output

This is the paragraph to show HTML border example. This will give border the all the sides of this div. The color of border is red. This border property has given here to display border.