CSS border-right (Set/Change Right Border of an Element)

The CSS border-right property is used when we need to set width, style, and color of the right border at once. For example:

HTML with CSS Code
<!DOCTYPE html>
<html>
<head>
   <style>
      p {border-right: 8px solid chocolate; padding: 10px;}
   </style>
</head>
<body>

   <p>This is a para.</p>
   
</body>
</html>
Output

This is a para.

The border-right is basically used as a shorthand for following three properties:

Note - In all three properties, the border-right-style is required.

CSS border-right Syntax

The syntax of border-right property in CSS, is:

border-right: width style color|initial|inherit;

Note - The initial is used to set the default color. The inherit is used to inherit the value from its parent.

CSS Online Test


« Previous Tutorial Next Tutorial »

Follow/Like Us on Facebook




Subscribe Us on YouTube