[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

using css to create expanding side columns with background images

Posted on 2010-09-08
2
Medium Priority
?
255 Views
Last Modified: 2012-05-10
On my page I want one center fixed width container, on either side of this container I want to have a background image that expands to fill the rest of the page. Like this:

<<expanding>>  <<fixed width 980px>> <<expanding>>

I'm having a very difficult time getting this to work. My layout looks basically like this:

<div class="side_bar">
  <div class="top_stripe">&nbsp;</div>
</div>
<div class="container">
<div class="side_bar">
  <div class="top_stripe">&nbsp;</div>
</div>

.side_bar {
      float: left;
}
.top_stripe {
      background-image: url(../images/top_bg_stripe.png);
      background-repeat: repeat-x;
      background-position: top;
      width: auto;
      height: 230px;
}
.container {
      width: 980px; /* the auto value on the sides, coupled with the width, centers the layout */
      margin-top: 0;
      margin-right: 0px;
      margin-bottom: 0;
      margin-left: 0px;
      float: left;
}

The sample page is here:

http://www.glowfishtw.com/play3on3/index.aspx#

I thought that by setting       width: auto; of top_stripe would cause that column to expand to fill up the extra space. Any ideas what I'm doing wrong here? Thanks.
0
Comment
Question by:elliottbenzle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 total points
ID: 33630982
change it to this

<div>
<div class="left_side_bar">
  <div class="top_stripe">&nbsp;</div>
</div>
<div class="container">
<div class="right_side_bar">
  <div class="top_stripe">&nbsp;</div>
</div>
</div>

.left_side_bar {
      float: left;
      width:10%;
}
.right_side_bar {
      float: right;
      width:10%;
}
.top_stripe {
      background-image: url(../images/top_bg_stripe.png);
      background-repeat: repeat-x;
      background-position: top;
      height: 230px;
}
.container {
      width: 98%; /* the auto value on the sides, coupled with the width, centers the layout */
      margin: 0 10%;
      float: left;
}

Open in new window

0
 
LVL 4

Author Closing Comment

by:elliottbenzle
ID: 33631801
Thanks
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question