我正在尝试在水平线上创建文本,我成功了。这是代码
HTML
<div class="featuredtext">
<h2><span>Featured Art Work</span></h2>
</div>
CSS
.featuredtext {
text-align: center;
}
.featuredtext h2 {
margin-top: 30px;
font-family: 'PrintClearlyRegular', Arial, Helvetica, sans-serif;
font-weight: normal;
font-style: normal;
font-size: 36px;
position: relative;
text-align: center;
color: #FFF;
z-index: 1;
}
.featuredtext h2:before {
border-top: 2px solid #ee357a;
content:"";
margin: 0 auto;
position: absolute;
top: 17px;
left: 0;
bottom: 0;
right: 0;
width: 100%;
z-index: -1;
}
.featuredtext h2 span {
background: #1a132a;
padding: 0 12px;
}
但是,我希望这条线像这样的线性渐变:http ://css-tricks.com/examples/hrs/列表中的第二行。但是,它仅适用于<hr>
并且我无法将其添加到边框顶部。如何获得我需要的结果?