HTML DOM Style borderRadius Property

The HTML DOM borderRadius propert is used to add rounded corners to the element’s four sides. Using this property, we can set and get the border radius properties like borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius.

Following is the syntax for −

Setting the borderRadius property: = "1-4 length|% / 1-4 length|%|initial|inherit"

The property values are explained as follows −

lengthFor defining the borders shape.
%For defining the borders shape in percentage.
initialFor setting this property to initial value.
inheritTo inherit the parent property value

Let us look at an example for the borderRadius property −


 Live Demo

<!DOCTYPE html>
      height: 100px;
      width: 200px;
      border: 10px groove orange;
      padding: 10px;
      border-radius: 1px 1px 1px 1px;
   function changeBorderRadius(){
      document.getElementById("DIV1").style.borderRadius="45px 45px 45px 45px";
      document.getElementById("Sample").innerHTML="The border radius for the four borders of the above div are now increased";
<div id="DIV1">SOME SAMPLE TEXT</div>
<p>Increase the above div border radius size by clicking the below button</p>
<button onclick="changeBorderRadius()">Change Border Radius</button>
<p id="Sample"></p>


On clicking the “Change Border Radius” button −

Updated on: 22-Oct-2019


Kickstart Your Career

Get certified by completing the course

Get Started