How to make double lines border in CSS, each line in different color, without using background image?

前端 未结 11 968
广开言路
广开言路 2020-12-24 12:38

How to make a double line border in CSS, each line in a different color without using background-image?

For example like this:

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 13:01

    You can do it with the :after pseudo element:

    http://jsfiddle.net/aCgAA/

    h2 {
    padding: 5px 0;
    border-bottom: solid 3px pink;
    font-weight: bold;
    position: relative;
    margin-bottom: 8px;
    }
    
    h2:after {
    content: '';
    border-bottom: solid 3px blue;
    width: 100%;
    position: absolute;
    bottom: -6px;
    left: 0;
    }
    

    This degrades gracefully to a single line if the :after selector is not available.

提交回复
热议问题