切正圆

水平半径和垂直半径相等



<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
 
        div {
            width: 200px;
            height: 200px;
            margin: 25px;
            border: 1px solid black;
            background-color: red;
        }
 
        div:nth-of-type(1) {
            /* 一个值代表4个半径都是20px的正圆 */
            border-radius: 20px
        }
        div:nth-of-type(2) {
            /* 两个值代表左上右下是20px,右上左下是40px的正圆 */
            border-radius: 20px 40px ;
        }
        div:nth-of-type(3) {
            /* 三个值代表左上20px,右上和左下是40px,右下是60px的正圆 */
            border-radius: 20px 40px 60px;
        }
        div:nth-of-type(4) {
            /* 四个值分别代表左上20px,右上40px,右下60px,左下80px的正圆 */
            border-radius: 20px 40px 60px 80px;
        }
    </style>
</head>
 
<body>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</body>
</html>

 切椭圆

水平半径和垂直半径不一致,用“/”分开。“/”前是水平方向半径“/”后是垂直半径。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        div {
            width: 200px;
            height: 200px;
            margin: 25px;
            border: 1px solid black;
            background-color: red;
        }
        div:nth-of-type(1) {
            /* 4个椭圆水平半径是20 垂直半径是40。 */
            border-radius: 20px/40px;
        }
        div:nth-of-type(2) {
            /* 左上和右下水平半径都是20,垂直半径是40的椭圆,右上和左下水平半径是50 垂直半径是60的椭圆。 */
            border-radius:20px 50px/40px 60px;
        }
        div:nth-of-type(3) {
            /* 左上水平半径都是20,垂直半径是40的椭圆,右上和左下水平半径是50 垂直半径是60的椭圆,右下水平半径是70 垂直半径是80的椭圆。 */
            border-radius:20px 50px 70px/40px 60px 80px;
        }
        div:nth-of-type(4) {
            /* 左上水平半径都是20,垂直半径是40的椭圆,右上水平半径是50 垂直半径是60的椭圆,右下水平半径是70 垂直半径是80的椭圆,左下水平半径是90 垂直半径是120的椭圆。 */
            border-radius:20px 50px 70px 90px/40px 60px 80px 120px;
        }
    </style>
</head>
<body>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</body>
</html>