Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style borderRadius property

Style borderRadius property

Style Object Reference The Style object

Example

Add a rounded border to a div element:

document.getElementById("myDIV").style.borderRadius="25px";

Try it »


Definition and Usage

The borderRadius property is a shorthand property for setting or returning the four border radius properties.

**Tip:** This property allows you to add rounded borders to an element!


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

IE9+, Firefox, Chrome, Safari, and Opera support the borderRadius property.


Syntax

Return the borderRadius property:

object

.style.borderRadius

Set the borderRadius property:

object

.style.borderRadius="

1-4 length

|

%

/

1-4 length

|

%

|initial|inherit"

**Note:** The four values for the radii are given in the order top-left, top-right, bottom-right, and bottom-left. If the bottom-left value is omitted, it is the same as the top-right value. If the bottom-right value is omitted, it is the same as the top-left value. If the top-right value is omitted, it is the same as the top-left value.

Attribute values

Value Description
length Defines the shape of the corners. The default value is 0.
% Defines the shape of the corners in %.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default value: 0
Return Value: A string representing the element's border-radius property.
CSS version CSS3

Related Articles

CSS Reference Manual:The border-radius property


Style Object Reference The Style object