Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9237265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:29:54+00:00 2026-06-18T07:29:54+00:00

I am trying to make a decorative heading with horizontal lines either side, similar

  • 0

I am trying to make a decorative heading with horizontal lines either side, similar to http://www.impressivewebs.com/centered-heading-horizontal-line/ but with the following constraints:

  • Support arbitrary header text
  • Fluid – stretches to fit the width of the page
  • The horizontal lines are images – each line is comprised of a decorative “tip” image, and then a repeating section which should stretch as far as needed to fill the page width
  • The decorative tip images are fixed widths (297px each)
  • Solution must work with background image on web page
  • As the page width shrinks, the repeating sections of the images get smaller and eventually disappear. The heading text in the middle then wraps onto multiple lines, if necessary.

I am trying to use CSS only for the solution, although I would consider JavaScript help if it cannot be done with pure CSS.

I have seen a few similar questions on SO, but I don’t think that any of the solutions would do quite what I’m looking for.

Here is my own naive attempt (also at http://jsfiddle.net/39qLr/1/). For simplicity I have coloured the “tip” images in red, and the flexible repeating images in yellow. The obvious problem is that the yellow parts are not showing up right now!

HTML:

<div class="heading-container">
    <div class="left-tip"></div>
    <div class="left-filler"></div>
    <h1>Heading Text</h1>
    <div class="right-filler"></div>
    <div class="right-tip"></div>
</div>

CSS:

.heading-container {
    display: table;
    width: 100%;
}

.left-tip, .right-tip {
    background-color: red;
    width: 297px;
    display: table-cell;
}

.left-filler, .right-filler {
    background-color: yellow;
    display: table-cell;
}

h1 {
    text-align: center;
    display: table-cell;
}

I am very grateful for any guidance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:29:55+00:00Added an answer on June 18, 2026 at 7:29 am

    With help from a colleague, we have managed to get as close as we think is possible:

    http://jsfiddle.net/rbCvq/

    HTML (same as before):

    <div class="heading-container">
        <div class="cell left-tip">&nbsp;</div>
        <div class="cell left-filler">&nbsp;</div>
        <h1 class="cell heading-text">Heading Text</h1>
        <div class="cell right-filler">&nbsp;</div>
        <div class="cell right-tip">&nbsp;</div>
    </div>
    

    CSS:

    .heading-container {
        display: table;
        width: 100%;
    }
    
    .cell
    {
        display: table-cell;
    }
    
    .left-tip, .right-tip {
      width: 297px;
      background: red;
    }
    
    .left-filler, .right-filler {
      background: yellow;
    }
    
    .heading-text {
      width: 1px;
      white-space: nowrap;
    }
    

    The secret sauce that makes it work seems to be:

    • the 1px width on the heading element
    • adding the white-space: nowrap
    • the nbsp; in the empty DIVs

    Of course this doesn’t fulfil my original criteria of making the text wrap onto multiple lines, but I think the overall effect works about as well as we could hope. Also, the markup is a bit heavy on the DIVs, which serve no semantic purpose.

    Thank you for all the suggestions, and I hope this is useful to somebody else one day!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a simple rollover image for this page - www.radioandweb.com.
I'm trying to make a color fading menu similar to the one on www.guitaracademy.nl
Trying to make a cross protocol, same domain request from https to http. I
I am trying to make my transparent menu appear centered , but whatever method
I'm trying to make an horizontal menu, vertically and horizontally aligned. I'm actually using
I'm trying to make a horizontal menu with CSS but i've run into a
I'm trying to make this simple iContact form not to redirect to either success
This menu is a multi-level horizontal menu. I am trying to make a 3nd
I'm trying to make a horizontal menu layout in CSS. I was using the
I'm trying make a login window where a user is prompted to enter their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.