1

I want the outer div to span to all the page width with the background color #efefef. The inner div will be centered and have white background with 995px width.

So i have this code:

  <div style="background-color:#efefef;width:100%;">
    <div id="photoUploadWrap">

Now the photoUploadWrap style is:

#photoUploadWrap{width: 995px;margin: auto;}

And it has tables and more divs inside it. The div gets centered alright but the outer div doesn't display the #efefef background.

What's wrong here? I also tried to put a border on the outer div with no success.

1
  • Do any of the "tables and more divs inside" have the float property set? Commented Apr 4, 2011 at 13:37

2 Answers 2

2

The outer div has no height (or at least the browser doesn't think so). This is why you don't see the border or the background color. Why not just set the background color on the body tag?

Sign up to request clarification or add additional context in comments.

Comments

0

Not sure why this isnt working, but when I changed it to:

  <div id="divContainer">
    <div id="photoUploadWrap">
aaaa
      </div>
</div>

#photoUploadWrap{width: 995px;margin: 0 auto;}
#divContainer { width: 100%; background-color: #efefef; }

it worked. check it Live

1 Comment

i need the same, but wirh the #photouploadwrap with background, i have somthing similar, but the third div not shows the background color

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.