我试图沿着我的标题元素的基线获得这种效果。
最好的方法是什么?有没有办法在没有图像的情况下做到这一点(也许是 SVG)?
我认为这可以很好地完成的一种方法是在绝对定位的伪元素上使用白色方块的重复 x 背景图像。但是,它使用图像,我很想能够避免这种情况。
Dav*_*ric 11
这是解决方案。它被称为之字形边框。
http://jsfiddle.net/justinmc/QqnD3/
<div class="container">
<h1>Content Here</h1>
</div>
.container {
position: relative;
padding: 8px 8px 32px 8px;
background: #dddccf;
}
.container:after {
background: linear-gradient(-45deg, #ffffff 16px, transparent 0), linear-gradient(45deg, #ffffff 16px, transparent 0);
background-position: left-bottom;
background-repeat: repeat-x;
background-size: 32px 32px;
content: " ";
display: block;
position: absolute;
bottom: 0px;
left: 0px;
width: 100%;
height: 32px;
}
Run Code Online (Sandbox Code Playgroud)
学分 https://cocreate.localmotors.com/blog/post/zig-zag-borders-in-css/1205/