给容器右上角打标,带图标

假设容器的active类名为is-active,那么可以通过伪元素的方式来给容器打标。效果如下:

 

样式如下:

.is-active{
position: relative;
}
.is-active::after {
content:"";
position: absolute;
right: 0;
top: 0;
border-right: 20px solid #0A53C8;
border-top: 20px solid #0A53C8;
border-left: 20px solid transparent;
border-bottom: 20px solid transparent;
width: 0;
height: 0;
}
.is-active::before {
content: "\e6da";
font-family: element-icons !important;
color: #fff;
font-size: 20px;
font-weight: bold;
position: absolute;
right: 0px;
top: 0px;
z-index: 9;
}

posted @ 2024-06-05 18:00  逸凨  阅读(2)  评论(0编辑  收藏  举报