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);
}
文章来自:https://www.cnblogs.com/xiaoyucoding/p/12527056.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3