【发布时间】:2017-07-04 13:44:57
【问题描述】:
如何重现设计(见下文),以便不支持剪辑路径多边形的浏览器可以看到它?我希望它在不旋转的情况下倾斜顶部边缘 或倾斜整个 div。这可能吗?
HTML:
<div class="angledbox">
<div class="textstuff">
<p class="title">Title</p>
<p class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada, turpis vitae hendrerit interdum, mauris augue viverra enim, id ultrices dui felis scelerisque ligula.</p>
</div>
</div>
CSS:
.angledbox {
background-color: #5EA359;
width: 100%;
padding-top: 80px;
padding-bottom: 20px;
-webkit-clip-path: polygon(0 0, 6000px 100%, 100% 100%, 0 100%);
clip-path: polygon(0 0, 6000px 100%, 100% 100%, 0 100%);
}
.title {
font-size:30px;
margin:0px;
padding:0px;
font-weight:bold;
text-align:center;
color:white;
text-transform:uppercase;
}
.text {
color:white;
text-align:center;
margin:0px;
padding:0px;
font-size: 18px;
}
.textstuff {
width:20%;
margin:auto;
padding-bottom:20px;
}
演示
【问题讨论】:
-
只是折腾想法:也许添加一个带有
::before的div,然后给它一个巨大的border(查找CSS三角形/箭头)。或者也许有一个孩子div,在后台,你旋转。父 div 用overflow: hidden截断左边或右边的部分。 -
@domdom 谢谢,我会调查一下。