How can I make a fieldset legend-style “background line” on heading text?

前端 未结 9 1350
后悔当初
后悔当初 2020-11-29 08:31

I\'m attempting to style heading text similar to how your default legend text appears in fieldsets; that is to say, I\'d like a strikethrough-like line to come up to, but no

9条回答
  •  难免孤独
    2020-11-29 09:08

    This doesn't feel like a very good answer, but I'm posting it anyway.

    See: http://jsfiddle.net/rFmQg/

    Centered Header Text

    h2 { background: url(http://dummyimage.com/2x1/f0f/fff&text=+) repeat-x center; text-align: center } h2 span { background: #fff; padding: 0 9px }

    I don't like it because:

    • You have to use an image.
    • This. (it only works if the backgrounds match)

提交回复
热议问题