CSS border properties

CSS Border Property

Description

Border is a shorthand property that sets the style, color, and width of the border around an element.

Possible Values

Possible values ​​are one or more colors, a border-width value, and a border-style value.

Applies to

All HTML elements.


DOM syntax

object.style.border = "2px solid red"; 

Example

The following example shows how to combine these three properties into a single one. This is the most commonly used property for setting the border of any element.

<html> 
<head> 
</head> 

<body> 
<p style = "border:4px solid red;"> 
This example is showing shorthand property for border. 
</p> 
</body> 
</html> 

It will produce the following result −

CSS Border Properties

Leave a Reply

Your email address will not be published. Required fields are marked *