13

Imagine I have any block or inline block with text in it. Like a paragraph or li or whatever. If that tag has the "separator" class, I want it to appear as follows:

All content is centred (text-align:center; will suffice). Here's the tricky part: on either side of the centred content, a (vertically-centred) line appears.

The following image illustrates my idea:

Approximate example of what I'd like it to look like (although this is using text... "------ SEPARATE ------"

If I have to introduce more HTML, then forget about it - not interested.

I'm a long time CSS user, but I can't figure this one out... Anyone else got an idea? As much as I love it, preferably no CSS3 (for work... can't use new stuff because of compatibility)..

Example problem: <p class="separator">CENTRE ME</p>

Bilal Akil
  • 4,716
  • 5
  • 32
  • 52
  • 1
    http://stackoverflow.com/questions/2812770/add-centered-text-to-the-middle-of-a-hr-like-line/2812813#2812813 – willoller Sep 28 '12 at 23:40
  • Not quite willoller, question's pretty easy if you can introduce more HTML (as in that post) - this is challenge mode – Bilal Akil Sep 28 '12 at 23:41
  • omfg I think Niel is on to something – willoller Sep 29 '12 at 00:00