效果预览:效果预览
源码下载:关注公众号【RMRF】,回复【css10】可获取源码
一、HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>列表标签</title>
<link rel="stylesheet" href="./css/index.css">
</head>
<body>
<div class="container">
<div class="list">
<div class="box">
<div class="label">置顶</div>
</div>
</div>
</div>
</body>
</html>
二、CSS样式
* {
padding: 0px;
margin: 0px;
}
.container {
display: flex;
align-items: center;
justify-content: center;
flex-flow: column;
height: 100vh;
}
.list {
position: relative;
width: 80%;
max-width: 500px;
background: #e8e8e8;
padding: 20px;
border-radius: 5px;
height: 150px;
cursor: pointer;
transition: 0.3s all;
}
.list:hover {
transform: scale(0.9);
}
.box {
position: absolute;
overflow: hidden;
width: 150px;
height: 150px;
top: -10px;
right: -10px;
}
.box::before {
content: '';
position: absolute;
width: 10px;
height: 10px;
left: 53px;
z-index: -1;
background-image: linear-gradient(45deg, #ff8800 0%, #ffc079 55%, #ff8800 100%);
}
.box::after {
content: '';
position: absolute;
width: 10px;
height: 10px;
right: 0px;
top: 87px;
z-index: -1;
background-image: linear-gradient(45deg, #ff8800 0%, #ffc079 55%, #ff8800 100%);
}
.box .label {
position: absolute;
line-height: 30px;
text-align: center;
width: 170px;
height: 30px;
background-image: linear-gradient(45deg, #ff8800 0%, #ffc079 55%, #ff8800 100%);
color: #fff;
top: 18px;
right: -43px;
transform: rotate(45deg);
}