CSS3 common border summary

<! DOCTYPEhtml>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CSS 3 border</title>
    <style>
        body.ul.li.dl.dt.dd.h1.h2.h3.h4.h5 {
            margin: 0;
            padding: 0;
        }

        body {
            background-color: #F7F7F7;
        }

        .wrapper {
            width: 1000px;
            margin: 0 auto;
            padding: 20px;
            box-sizing: border-box;
        }

        header {
            padding: 20px 0;
            margin-bottom: 20px;
            text-align: center;
        }

        header h3 {
            line-height: 1;
            font-weight: normal;
            font-size: 28px;
        }

        .main {
            /*overflow: hidden; * /
        }

        .main:after {
            content: ' ';
            clear: both;
            display: block;
        }

        .main .item {
            width: 210px;
            height: 210px;
            margin: 0 30px 30px 0;
            display: flex;
            position: relative;
            background-color: #FFF;
            float: left;
            box-shadow: 2px 2px 5px #CCC;
        }

        .main .item:after {
            content: attr(data-brief);
            display: block;
            width: 100%;
            height: 100%;
            text-align: center;
            line-height: 210px;
            position: absolute;
            top: 0;
            left: 0;
            color: #FFF;
            font-family: Microsoft Yahei;
            font-size: 18px;
            background-color: rgba(170.170.170.0);
            z-index: -1;
            transition: all 0.3 s ease-in;
        }

        .main .item:hover:after {
            background-color: rgba(170.170.170.0.6);
            z-index: 100;
        }

        .main .item:nth-child(4n) {
            margin-right: 0;
        }

        /*.main .item:nth-last-child(-n+5) { margin-bottom: 0; } * /

        /* This is the skeleton style */
        /* 1, 2, 3, 4 clockwise */
        .border-radius {
            width: 180px;
            height: 180px;
            margin: auto;
            border: 1px solid red;
            /*border-radius: 50% 30% 20%; * /
        }

        .square {
            border-radius: 0;
        }

        / * * / arch
        .item:nth-child(1) .border-radius {
            border-radius: 90px;
        }

        / * * / arch
        .item:nth-child(2) .border-radius {
            border-radius: 90px 90px 0 0;
        }

        / * semicircle * /
        .item:nth-child(3) .border-radius {
            height: 90px;
            border-radius: 90px 90px 0 0;
        }

        /* top left corner */
        .item:nth-child(4) .border-radius {
            /*height: 90px; * /
            border-radius: 90px 0 0 0;
        }

        /* quarter circle */
        .item:nth-child(5) .border-radius {
            width: 90px;
            height: 90px;
            border-radius: 90px 0 0 0;
        }

        /* horizontal ellipse */
        .item:nth-child(6) .border-radius {
            height: 90px;
            /*border-radius: 50%; * /
            border-radius: 90px 90px 90px 90px / 45px 45px 45px 45px;
            /*border-radius: 45px / 90px; * /
        }

        /* Vertical ellipse */
        .item:nth-child(7) .border-radius {
            width: 90px;
            border-radius: 45px 45px 45px 45px / 90px 90px 90px 90px;
        }

        /* Half of a horizontal ellipse */
        .item:nth-child(8) .border-radius {
            height: 45px;
            border-radius: 90px 90px 0 0 / 45px 45px 0 0;
        }

        /* Half of a vertical ellipse */
        .item:nth-child(9) .border-radius {
            width: 45px;
            border-radius: 45px 0 0 45px / 90px 0 0 90px;
        }

        /* a quarter of a vertical oval */
        .item:nth-child(10) .border-radius {
            width: 45px;
            height: 90px;
            border-radius: 45px 0 0 0 / 90px 0 0 0;
        }

        / * * / bread ring
        .item:nth-child(11) .border-radius {
            width: 40px;
            height: 40px;
            border: 70px solid red;
            border-radius: 90px;
        }

        / * * / round cake
        .item:nth-child(12) .border-radius {
            width: 40px;
            height: 40px;
            border: 70px solid red;
            border-radius: 60px;
        }

        /* top left round cake */
        .item:nth-child(13) .border-radius {
            width: 60px;
            height: 60px;
            border: 60px solid red;
            border-radius: 90px 0 0 0;
        }

        /* Diagonal pie */
        .item:nth-child(14) .border-radius {
            width: 60px;
            height: 60px;
            border: 60px solid red;
            border-radius: 90px 0 90px 0;
        }

        /* Four different colors */
        .item:nth-child(15) .border-radius {
            width: 0px;
            height: 0px;
            border-width: 90px;
            border-style: solid;
            border-color: red green yellow blue;
        }

        /* Right transparent */
        .item:nth-child(16) .border-radius {
            width: 0px;
            height: 0px;
            border-width: 90px;
            border-style: solid;
            border-color: red green yellow blue;
            border-right-color: transparent;
        }

        /* Circle right transparent */
        .item:nth-child(17) .border-radius {
            width: 0px;
            height: 0px;
            border-width: 90px;
            border-style: solid;
            border-color: red;
            border-right-color: transparent;
            border-radius: 90px;
        }

        /* Circle right red transparent */
        .item:nth-child(18) .border-radius {
            width: 0px;
            height: 0px;
            border-width: 90px;
            border-style: solid;
            border-color: transparent;
            border-right-color: red;
            border-radius: 90px;
        }

        /* Yin-yang diagram past life */
        .item:nth-child(19) .border-radius {
            width: 180px;
            height: 0px;
            border-top-width: 90px;
            border-bottom-width: 90px;
            border-style: solid;
            border-top-color: red;
            border-bottom-color: green;
            /*border-right-color: red; * /
            border-radius: 90px;
        }

        /* Yin-yang diagram past life 2*/
        .item:nth-child(20) .border-radius {
            width: 180px;
            height: 90px;
            border-bottom-width: 90px;
            border-style: solid;
            border-bottom-color: green;
            background-color: red;
            /*border-right-color: red; * /
            border-radius: 90px;
        }

        /* Yin-yang figure this life */
        .item:nth-child(21) .border-radius {
            width: 180px;
            height: 90px;
            border-bottom-width: 90px;
            border-style: solid;
            border-bottom-color: green;
            background-color: red;
            border-radius: 90px;
            position: relative;
        }

        .item:nth-child(21) .border-radius::after..item:nth-child(21) .border-radius::before {
            content: ' ';
            position: absolute;
            top: 50%;
            width: 20px;
            height: 20px;
            /*margin: -10px 0 0 0; * /
            border-width: 35px;
            border-style: solid;
            border-radius: 45px;
        }

        /* Left yin-yang */
        .item:nth-child(21) .border-radius::after {
            background-color: red;
            border-color: green;
        }

        /* Right Yin and Yang */
        .item:nth-child(21) .border-radius::before {
            background-color: green;
            border-color: red;
            right: 0;
        }

        /* Right Yin and Yang */
        .item:nth-child(22) .border-radius {
            width: 180px;
            height: 90px;
            border-bottom-width: 90px;
            border-bottom-color: green;
            border-bottom-style: solid;
            background-color: red;
            border-radius: 90px;
            position: relative;
        }

        .item:nth-child(22) .border-radius::after..item:nth-child(22) .border-radius::before {
            content: ' ';
            position: absolute;
            top: 50%;
            width: 20px;
            height: 20px;
            border-width: 35px;
            border-style: solid;
            border-radius: 45px;
        }

        .item:nth-child(22) .border-radius::before {
            border-color: green;
            background-color: red;
        }

        .item:nth-child(22) .border-radius::after {
            right: 0;
            border-color: red;
            background-color: green;
        }

        /* Message box */
        .item:nth-child(23) .border-radius {
            width: 160px;
            height: 80px;
            background-color: red;
            border-radius: 6px;
            position: relative;
        }

        .item:nth-child(23) .border-radius::after {
            content: ' ';
            width: 0;
            height: 0;
            border-width: 10px;
            border-style: solid;
            border-color: transparent;
            border-right-color: red;
            position: absolute;
            top: 16px;
            left: -20px;
        }

        /* Strange graphics */
        .item:nth-child(24) .border-radius {
            width: 40px;
            height: 40px;
            border-width: 45px 0 45px 70px;
            border-style: solid;
            border-radius: 0 0 60px 0;
            border-color: red;
        }

        /* strange graphics 2*/
        .item:nth-child(25) .border-radius {
            width: 100px;
            height: 40px;
            border-width: 45px 20px 45px 70px;
            border-style: solid;
            border-radius: 60px;
            border-color: red;
        }

        / * * / QQ dialogue
        .item:nth-child(26) .border-radius {
            width: 160px;
            height: 80px;
            background-color: red;
            border-radius: 6px;
            position: relative;
        }

        .item:nth-child(26) .border-radius::after {
            content: ' ';
            position: absolute;
            top: 0;
            right: -20px;
            width: 30px;
            height: 30px;
            border-width: 0 0 30px 30px;
            border-style: solid;
            border-bottom-color: red;
            border-left-color: transparent;
            border-radius: 0 0 60px 0;
        }

        /* Set the percentage of rounded corners */
        .item:nth-child(27) .border-radius {
            width: 180px;
            /*height: 180px; * /
            height: 90px;
            border-radius: 50%;
            border-radius: 90px/45px;

            /* The percentage is calculated by the length of the two corresponding directions */
        }

    </style>
</head>
<body>
<div class="wrapper">
    <header>
        <h3>CSS3 border rounded corners</h3>
    </header>
    <div class="main">
        <div class="item" data-brief="Full circle">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Arch">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Round">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Top left corner">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Quarter circle">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="A horizontal oval.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="The ellipse standing upright.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Half a horizontal oval.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Half an ellipse standing upright.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="A quarter of a vertical oval.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Bread ring">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Pie">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Top left round cake.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Diagonal pie">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Four different colors.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Right transparent color">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Circle right transparent color">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Round right red transparent color">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Yin-yang Diagram past life.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Yin-yang Diagram Past Life 2">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Yin and Yang in the present life.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Yin-yang diagram of life 2">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Message box">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Strange shapes.">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Strange Figure 2">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="QQ dialogue">
            <div class="border-radius"></div>
        </div>
        <div class="item" data-brief="Rounded corner percentage">
            <div class="border-radius"></div>
        </div>
    </div>
</div>
</body>
</html>
Copy the code

The effect is as follows:

love

<! DOCTYPEhtml>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        .heart {
            width: 200px;
            height: 300px;
            /*border: 1px solid #000; * /
            margin: 100px auto;
            position: relative;
        }

        .heart::before..heart::after {
            content: "Left half";
            width: 100%;
            height: 100%;
            position: absolute;
            background-color: red;
            left: 0;
            top: 0;

            border-radius: 100px 100px 0 0;
            transform: rotate(-45deg);
            text-align: center;
            line-height: 100px;
            color: yellow;
            font-size: 30px;
            font-family: "MIcrosoft Yahei";
        }

        .heart::after {
            content: "Right half";
            left: 71px;
            transform: rotate(45deg);
        }
    </style>
</head>
<body>
<div class="heart">

</div>
</body>
</html>
Copy the code

The effect is as follows:

It’s actually a stack of these two boxes:

Change the left value of.heart::after to fold.