How to draw a line with css and show text or image on it

后端 未结 4 1635
后悔当初
后悔当初 2021-01-22 17:26

I\'m trying to draw a line using CSS and show text/image in the middle of the line.

4条回答
  •  庸人自扰
    2021-01-22 18:12

    Something like this? JSFiddle

    CSS:

    .featured-images {
        color: #666666;
    }
    p span {
        margin:0;padding: 0 10px;
        background: #FFFFFF;
        display: inline-block;
    }
    p {
        padding-left: 20px;
        position: relative;
        z-index: 2;   
    }
    p:after {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        border-top: solid 1px #666666;
        z-index: -1;
    }
    

提交回复
热议问题