这很简单。只需使用以下CSS:
.shape {
border-top: 100px solid blue;
border-right: 50px solid transparent;
height: 0;
width: 100px;
}
<div class="shape"></div>
编辑:
如果其中包含其他元素,则可以执行以下操作。
.shape {
background: blue;
height: 100px;
position: relative;
width: 150px;
color:white;
}
.shape::before {
background: blue none repeat scroll 0 0;
content: "";
height: 100px;
position: absolute;
right: -25px;
transform: skew(-20deg);
width: 50px;
}
<div class="shape">
<span>Hello</span>
<div> Test message </div>
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句