【发布时间】:2020-05-31 06:21:04
【问题描述】:
我在网上找到了这张图片,并尝试用 css 创建这些盒子。我失败了。有谁知道如何解决这个问题?
这是我的代码。问题出在左边栏:
.box {
position: relative;
margin: 10px;
display: inline-block;
}
.content {
border-top: 2px solid red;
border-right: 2px solid red;
padding: 5px;
}
.box:before {
content: '';
position: absolute;
top: 0;
left: -10px;
height: 100%;
width: 10px;
background-color: red;
transform: skew(-45deg) rotate(-45deg);
}
.box:after {
content: '';
position: absolute;
bottom: -10px;
left: -5px;
height: 10px;
width: 100%;
background-color: red;
transform: skew(-45deg);
}
<div class="box">
<div class="content">
CONTENT<br />
Some more content
</div>
</div>
【问题讨论】:
标签: css responsive-design css-shapes