<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>span绝对定位实现四角边框</title>
</head>
<body>
<div class="container">
<div class="panel">
<span class="corner corner-left-top"></span>
<span class="corner corner-right-top"></span>
<span class="corner corner-right-bottom"></span>
<span class="corner corner-left-bottom"></span>
<span class="name">推送批次</span>
<span class="num">754</span>
<span class="unit">批</span>
</div>
</div>
<style>
.container {
float: left;
height: 200px;
width: 200px;
border: 1px solid #ff0;
display: flex;
justify-content: center;
align-items: center;
}
.panel {
display: flex;
flex-direction: column;
position: relative;
height: 72px;
width: 72px;
background-color: rgba(10,33,100,0.4);
}
.name {
line-height: 28px;
text-align: center;
font-size: 13px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #fff;
}
.num {
line-height: 24px;
text-align: center;
font-size: 20px;
font-family: Impact;
font-weight: 400;
color: #02eeff;
}
.unit {
line-height: 17px;
text-align: right;
padding-right: 4px;
font-size: 12px;
font-family: PingFang SC;
font-weight: 400;
color: #02eeff;
}
.corner {
position: absolute;
height: 7px;
width: 7px;
background-color: transparent;
border: 1px solid #215aff;
}
.corner-left-top {
left: 0;
top: 0;
border-right: transparent;
border-bottom: transparent;
}
.corner-right-top {
right: 0;
top: 0;
border-left: transparent;
border-bottom: transparent;
}
.corner-right-bottom {
right: 0;
bottom: 0;
border-left: transparent;
border-top: transparent;
}
.corner-left-bottom {
left: 0;
bottom: 0;
border-right: transparent;
border-top: transparent;
}
</style>
</body>
</html>