CSS border-top-right-radius (Set/Change Radius of Top Right Border)

The CSS border-top-right-radius property is used when need to specify the radius of the top right corner of the border. For example:

HTML with CSS Code
<!DOCTYPE html>
<html>
<head>
   <style>
      h2 {border: 10px solid maroon; padding: 12px; border-top-right-radius: 20px;}
      p {border: 4px solid mediumvioletred; border-top-right-radius: 10px;}
   </style>
</head>
<body>

   <h2>The border-top-right-radius Property</h2>
   <p>This is a para.</p>
   
</body>
</html>
Output

The border-top-right-radius Property

This is a para.

CSS border-top-right-radius Syntax

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

border-top-right-radius: x;

The value of x should be any of the following:

CSS border-top-right-radius with Two Values

If two values are given to border-top-right-radius, then the first value applies to top border, whereas the second value applies to right border. For example:

HTML with CSS Code
<!DOCTYPE html>
<html>
<head>
   <style>
      p {border: 22px solid mediumvioletred; padding: 10px; border-top-right-radius: 10px 30px;}
   </style>
</head>
<body>

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

This is a para.

CSS Online Test


« Previous Tutorial Next Tutorial »


Liked this post? Share it!