扑克花色

作者:Keysqiu
创建时间:2025-11-30 18:19:02 最后一次修改时间:2025-11-30 18:19:02
Categories: Tags:

红心

   <div id="heart"></div>

#heart {
        position: relative;
        width: 100px;
        height: 90px;
    }
    #heart:before,
    #heart:after {
        position: absolute;
        content: "";
        left: 50px;
        top: 0;
        width: 50px;
        height: 80px;
        background: red;
        border-radius: 50px 50px 0 0;
        transform: rotate(-45deg);
        transform-origin: 0 100%;
    }
    #heart:after {
        left: 0;
        transform: rotate(45deg);
        transform-origin: 100% 100%;
    }

方块

    <div class="diamond_wrapper">
        <div class="diamond"></div>
    </div>

.diamond_wrapper {
        position: absolute;
        top: 100px;
        left: 100px;
    }
    .diamond {
        width: 0;
        height: 0;
        border: 50px solid transparent;
        border-bottom: 90px solid red;
        position: relative;
    }
    .diamond::after {
        content: "";
        position: absolute;
        left: -50px;
        top: 90px;
        width: 0;
        height: 0;
        border: 50px solid transparent;
        border-top: 90px solid red;
    }

黑桃

    <span class="heart-heitao">
        <span class="tale"></span>
    </span>
   
/* 1  先画一个正方形 */
    .heitao {
        width: 30px;
        height: 30px;
        transform: rotate(135deg);
        background-color: black;
        display: inline-block;
        margin: 0 10px;
        position: relative;
    }
    /* 2 画两个偏移的圆 通过伪元素创建 */
    .heitao:before,
    .heitao:after {
        content: "";
        border-radius: 50%;
        height: 30px;
        width: 30px;
        background: black;
        position: absolute;
    }
    .heitao:before {
        top: -15px;
        left: 0;
    }
    .heitao:after {
        left: 15px;
        top: 0;
    }
    /* 3 画小尾巴 通过border创建 */
    .tale {
        position: absolute;
        bottom: 20px;
        right: -3px;
        background: transparent;
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 20px solid black;
        transform: rotate(45deg);
    }

梅花

    <div class="circle"></div>
    <div class="triangle"></div>
    <div class="base"></div>
   
/* 外层容器 */
    .circle {
        width: 100px;
        height: 100px;
        background: red;
        border-radius: 50px;
        position: absolute;
        left: 63px;
        z-index: 100;
    }
    .circle:before {
        content: "";
        width: 100px;
        height: 100px;
        background: red;
        border-radius: 50px;
        position: absolute;
        left: -60px;
        top: 80px;
        z-index: 100;
    }
    .circle:after {
        content: "";
        width: 100px;
        height: 100px;
        background: red;
        border-radius: 50px;
        position: absolute;
        left: 60px;
        top: 80px;
        z-index: 100;
    }
    .triangle {
        width: 0;
        height: 0;
        border-left: 75px solid transparent;
        border-right: 75px solid transparent;
        border-bottom: 105px solid transparent;
        position: absolute;
        top: 40px;
        left: 38px;
        z-index: 100;
    }
    .base {
        background: none repeat scroll 0 0 yellow;
        height: 70px;
        position: absolute;
        left: 0;
        top: 140px;
        width: 200px;
        z-index: 0;
    }
    .base::before {
        width: 0px;
        height: 10px;
        position: absolute;
        left: 0;
        content: "";
        border-left: 50px solid white;
        border-right: 50px solid white;
        border-top: 10px solid white;
        border-bottom: 50px solid white;
        border-top-left-radius: 0px;
        border-top-right-radius: 0px;
        border-bottom-left-radius: 0px;
        border-bottom-right-radius: 60px;
    }
    .base::after {
        width: 0px;
        height: 10px;
        position: absolute;
        left: 125px;
        content: "";
        border-left: 50px solid white;
        border-right: 50px solid white;
        border-top: 10px solid white;
        border-bottom: 50px solid white;
        border-top-left-radius: 0px;
        border-top-right-radius: 0px;
        border-bottom-left-radius: 60px;
        border-bottom-right-radius: 0px;
    }