![](/img/trans.png)
[英]CSS style heading - background must cover only text with a bottom border
[英]CSS - Style border heading
使用伪元素并进行transform: skew()
h2 { display: inline-block; position: relative; padding: 0 2em; } h2:before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border: solid black; border-width: 0 1px 1px 0; transform: skew(-45deg); transform-origin: bottom; }
<h2>asdf</h2>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.