我想在背景色为绿色的框顶部创建对角线,如下例所示。我应该使用哪个CSS来执行此操作?在CSS中使用背景色创建对角线顶部
Diagonal line on top of green background color
我设法与此代码做到这一点:
.quote {
background: #41ade5;
color: #fff;
position: relative;
z-index: 1;
}
.quote:before {
background: inherit;
bottom: 0 !important;
content: '' !important;
display: block !important;
height: 50% !important;
left: 0 !important;
position: absolute !important;
right: 0 !important;
transform: skewY(1.5deg) !important;
transform-origin: 100% 0 !important;
z-index: -1 !important;
top: 0;
}`
但随后的对角线得到了很多的边缘,而不是尖锐的。显示在下面的图片:
是否有人在做对角线是比较干净的任何良好的CSS技巧?