Results 1 to 3 of 3

Thread: Best way to: background "stripe" at 100% wide while inner div is content-width?

  1. #1
    Join Date
    Apr 2011
    Seattle, WA

    Question Best way to: background "stripe" at 100% wide while inner div is content-width?

    Here is an example of what I mean: IMAGE

    The photo at the top is full-width as are the little "bars" that stick out the sides of the content, but they all have to line up with the content they are paired with... in the case of the first blue bar (at the top edge of the main photo) the general concept is fairly simple, like a full-width div with a content-width div inside of it, but some of the other ones are kind of confusing, like the ones that outline the "previous" and "next" arrow buttons on the carousels.

    Is there a "best practice" for making these kind of bars work and position properly?

    Thanks in advance for any help or advice.

  2. #2
    Join Date
    May 2007
    I think there are a few ways you can do it.

    You can use "position: absolute" to hover the boxes over the bars. While also using to "top, bottom, left, right" attributes in css.
    You can also use a negative margin to shift a div on top of another div.
    You could make the bar a background image. Although you want to try to limit the amount of images you load, which is why it's better to use css instead if it's a flat colored bar.
    "Profanity is the one language all programmers know best."

  3. #3
    Join Date
    Sep 2013
    I have done this in one of my application.
    Below is the example code and it has worked fine for me:
    <div class="stripeContainer">
    <div class="container">
    <div class="span-8">Column 1</div>
    <div class="span-8">Column 2</div>
    <div class="span-8 last">Column 3</div>
    <div class="container">
    <div class="span-12">Body goes here</div>
    <div class="span-12 last">Some sort of menu perhaps</div>
    Then you style .stripeContainer:

    width: 100%; /* this is usually implied */
    background-color: pink;

    For stripe you can follow up with the below link:


    Hope this helps.
    strad solutionswww.stradsolutions.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center