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?

Foam Seat Cushion

Aching back from coding all day? Try Back Problems

This foam seat cushion relieves lowerback pain, numbness and pressure sores by promoting healthy weight distribution, posture and spine alignment. Furthermore, it reduces pressure on the tailbone and hip bones while sitting. Perfect for sitting on the computer desk for long periods of time.

$ Check price
99.9599.95Amazon 4.5 logo(9,445+ reviews)

More Back Problems resources

Build modern and responsive webpages

Responsive Typography

Build modern and responsive webpages Try Front-end

Responsive web design helps your site maintain its design integrity on a variety of screen sizes, but how does it affect your typography? With this practical book, graphic designers, web designers, and front-end developers alike will learn the nuts and bolts of how to get the best appearance from type without sacrificing performance on any device.

$ Check price
24.9924.99Amazon 4.5 logo(3+ reviews)

More Front-end resources

Ad