07. Border Radius border-radius

Border Radius

Boxes that have straight corners are often unappealing to the eye. To make a more smooth, rounded corner, we can use the border-radius property.

We specify a unit length for the radius - the larger this is, the more circular your corners become.

With a border-radius of 5px.
With a border-radius of 10px.
With a border-radius of 10px 20px.
With a border-radius of 10px 15px 20px 25px.

Specifying a specific corner

If you'd like to specify specific a specific corner, use:border-top-left-radius border-top-right-radius border-bottom-right-radius border-bottom-left-radius

The shorthand for these is from border-radius.

  1. One value specifies all corners.
  2. Two values specify the top-left/bottom-right, and top-right/bottom-left.
  3. Three values specify top-left, top-right/bottom-left, and bottom-right.

Creating an Ellipse

To create an ellipse, specify a width and height, then give two unequal values for the border-radius, separated by a forward slash (/).

#oval {
  width: 200px;
  height: 100px;
  border-radius: 100px / 50px;
  background: blue;
  margin: 10px auto;
}

Aching back from coding all day?

Prism Glasses

Aching back from coding all day? Try Back Problems

Ever feel achy from sitting crunched up on your computer table? Try lying down with these optical glasses that allow you to work on your laptop while lying flat on your back. This is the perfect solution with those with limited mobility or those who wish to prevent neck cramps and back strains.

$ Check price
4.454.45Amazon 4 logo(128+ reviews)

More Back Problems resources

Build modern and responsive webpages

The Modern Web

Build modern and responsive webpages Try Front-end

The Modern Web will guide you through the most important tools of device-agnostic web development, including HTML5, CSS3, and JavaScript. The plain-english explanations and practical examples emphasize the techniques, principles, and practices that you'll need to easily transcend individual browser quirks and stay relevant as these technologies are updated.

$ Check price
34.9534.95Amazon 4.5 logo(30+ reviews)

More Front-end resources

Ad