CSS 实现叉号

<div class="close"></div>
.close {
    position: relative;
    width: 40px;
    height: 40px;
}

.close::before,
.close::after {
    position: absolute;
    content: ' ';
    background-color: red;
    left: 20px;
    width: 1px;
    height: 40px;
}

.close::before {
    transform: rotate(45deg);
}

.close::after {
    transform: rotate(-45deg);
}
posted @ 2020-03-19 20:45  月半流云  阅读(5755)  评论(0编辑  收藏  举报