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

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