css -- 布局 盒子加丝带
程序员文章站
2022-05-01 20:17:31
...
效果:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
position: relative;
width: 150px;
height: 150px;
background-color: #adf;
margin: 110px auto;
border-radius: 6px;
box-sizing: border-box;
padding: 0 11px 11px;
overflow: hidden;
}
.box p {
height: calc(100% - 64px);
overflow: auto;
font-size: 12px;
padding: 0 6px;
}
.box p::-webkit-scrollbar {
width: 2px;
background-color: #adf;
border-radius: 5px;
}
.box p::-webkit-scrollbar-track {
border-radius: 5px;
}
.box p::-webkit-scrollbar-thumb {
border-radius: 5px;
background-color: #dfa;
}
.mark {
width: 100%;
position: absolute;
top: 11%;
left: 33%;
background-color: #EA0A0A;
color: #ffffff;
transform: rotate(45deg);
text-align: center;
}
</style>
</head>
<body>
<div class="box">
<div class="mark">标签</div>
<h3>标题</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere magni atque sunt ea natus labore,
voluptatibus, rem praesentium laborum aspernatur expedita neque qui saepe quibusdam suscipit, eaque ullam
tenetur! Assumenda.</p>
</div>
</body>
</html>