Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS3 border-radius property


May 05, 2021 CSS Reference Manual


Table of contents


Add a fillet border to the div element:

div
{
border:2px solid;
border-radius:25px;
}

Give it a try yourself

There are more instances at the bottom of the page.

Browser support

Property
border-radius 4.0 -webkit- 9.0 4.0 -moz- 5.0 -webkit- 10.5 -o-

IE9 plus, Firefox 4 plus, Chrome, Safari 5 plus, and Opera support border-radius properties.

Definitions and usages

The border-radius property is a short-case property that sets four border--radius properties.

Tip: This property allows you to add fillet borders to elements!

Default: 0
Inheritance: no
Version: CSS3
JavaScript syntax: object .style.borderRadius="5px"

Grammar

border-radius: 1-4 length|% / 1-4 length|%;

Note: Set four values for each radii in this order. I f bottom-left is omitted, it is the same as top-right. I f bottom-right is omitted, it is the same as top-left. If top-right is omitted, it is the same as top-left.

Value Describe Test
length Defines the shape of the fillet. Test
% Defines the shape of the fillet as a percentage. Test

Example 1

border-radius:2em;

Equivalent to:

border-top-left-radius:2em;
border-top-right-radius:2em;
border-bottom-right-radius:2em;
border-bottom-left-radius:2em;

Example 2

border-radius: 2em 1em 4em / 0.5em 3em;

Equivalent to:

border-top-left-radius: 2em 0.5em;
border-top-right-radius: 1em 3em;
border-bottom-right-radius: 4em 0.5em;
border-bottom-left-radius: 1em 3em;

Related pages

CSS3 tutorial: CSS3 border