How to have a horizontal line at the middle of a html heading with CSS?

前端 未结 4 388
悲哀的现实
悲哀的现实 2021-01-15 05:39

Ok I now use an image to do it, but I want to do it via CSS(no absolut or relative positioning, I\'m looking to make it responsive).

Example here: http://teothemes.

4条回答
  •  滥情空心
    2021-01-15 06:16

    Here's my go at it... Only thing is the spans have a set width.

    HTML

    asdf
    ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

    CSS

    #hr span {
        width:200px;
        border-bottom:1px solid #ccc;
        display: inline-block;
        margin-bottom:5px;
    }
    

    DEMO

提交回复
热议问题