<style>
.box{
position: relative;
height: 100px;
width: 300px;
border: 1px solid gray;
box-sizing: border-box;
}
.sanjiao{
position: absolute;
top: 0;
right: 0;
height: 60px;
width: 60px;
background-color: red;
clip-path: polygon(0 0, 100% 100%,100% 0);
}
.sanjiao-text{
position: absolute;
top: 0;
right: 0;
z-index: 4;
color: #fff;
transform: rotate(45deg);
transform-origin: 0 50%;
}
</style>
</head>
<body>
<div class="box">
<div class="sanjiao"></div>
<div class="sanjiao-text">封存</div>
</div>
</body>
.sanjiao{
position: absolute;
top: 0;
right: 0;
height: 60px;
width: 60px;
background-color: red;
clip-path: polygon(0 0, 100% 100%,100% 0);
}
.sanjiao-text{
position: absolute;
top: 0;
right: 0;
z-index: 4;
color: #fff;
transform: rotate(45deg);
transform-origin: 50% 50%;
height: 60px;
width: 60px;
text-align: center;
line-height: 30px;
white-space: nowrap;
}
标签:right,右上角,标签,100%,60px,height,color,position,css From: https://www.cnblogs.com/zhyp/p/17645835.html