【发布时间】:2017-06-21 15:53:33
【问题描述】:
我需要使用border-radius 和渐变边框来设置li 元素的样式,这样它就会看起来像这样:
HTML:
<li class="myTab">
Hello World!
</li>
问题是li 中的文本没有包含在任何内容中,我无法更改它。我正在使用LESS,尝试过:
.TAB() {
#gradient > .linear(top; #655724 0%, #d0704c 50%, #b24e31 100%);
border-radius: 15px;
position: relative;
&::before{
content: '';
position: absolute;
width: ~'calc(100% - 4px)';
height: ~'calc(100% - 4px)';
#gradient > .radialEllipse(center; closest-corner; #b4812a 0%, #374e0a 100%);
border-radius: 14px;
}
}
看起来不错,除了文本被伪元素覆盖。有什么方法可以在不更改html的情况下将文本放在前面?
附注我也不允许使用 z-index T^T
【问题讨论】: