如何将两种颜色应用于标题标签的底部边框?

时间:2015-11-07 12:48:24

标签: html css

我有一个带CSS的h2标签:

h2 {
    display: inline-block;
    border-bottom: 3px solid #ffcc00;
    padding-bottom: 30px;
    color:  #5e5e5e;
    font-size: 23px;
    font-weight: 400;
    line-height: 18px;
    text-align: left;
    margin: 30px 3px; }

它看起来像那样:

[1]

但我想填补"宽度的其余部分"有不同的边界。看起来应该是这样的:

enter image description here

2 个答案:

答案 0 :(得分:1)

HTML

<h2>
    <span>Some header</span>
</h2>

CSS

h2 { 
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: lightgray;
}

span {
    border-bottom-width: 3px;
    border-bottom-style: solid;
    border-bottom-color: orange;
    padding: 30px 3px;
    margin: 0 0 -2px 0;
    display: inline-block;
}

DEMO:http://jsfiddle.net/neowar2x/3/

答案 1 :(得分:0)