views:

44

answers:

2

I have this site where I need to place two images at the top of the page on each side of the content. Temporarily it can be reached [removed].

If your resolution is wide enough you can see both right and left red Christmas decorations are aligned to the main content. However the right ones are not taken out of the page flow and create a horizontal scrollbar if the browser is smaller than ~1300px across.

I achieved the two ornaments by placing two absolutely positioned divs with backgrounds into a relatively positioned div:

<div id="alignment"> <!-- position:relative -->
 <div></div> <!-- first image: position:absolute;right:-210px -->
 <div></div> <!-- second one: position:absolute;right:915px -->
</div>

Although absolutely positioned elements should be taken out of the document flow, the second image isn't :( Thus, the bottom scrollbar appears.

What I tried:

  • making an image of both ornaments with 910px (the width of the content) of empty space apart and using only one absolute div instead of two: same issue
  • adding the aforementioned image to be the no-repeat top center background of <html> which resulted in only one background showing. Either I have the snowflakes on the body bg or the red ornaments over a solid white background. The latter depends on which of the two (body or html) elements have which image as the background.
  • placing image divs in an absolute div and making the two relative (opposite of current situation) - same issue AND does not display on <IE8

I know and am sorry for this is a big issue and hard to understand. I researched a lot and am out of ideas. Any possible solution to try out would be greatly appreciated. Also, I realize the coding of the site i linked to is on the verge of terrible, but I have just started working on it, so no comments on that, please :)

A: 

try setting this div (#alignmen) with:

overflow: hidden;

Update:

<div id="main"> //Position this relatively
   <div> //Positon this absolutely, this height should be the max of the two floated divs
     //In here 
     <div>Left</div>//Float Left
     <div>Right</div>//Float Right
   </div>
<div>
Colour Blend
That didn't help; the whole browser window gets the scrollbar and not that div. The main content of the site is within the #alignment too. Adding your solution hides the decorations whatsoever, but thanks for trying to help :)
Raveren
Could you add my suggested fix to the site. So i could take a look at the live sample. I'll be waiting.
Colour Blend
live! go see it, I'll remove it in half an hour or when you post
Raveren
Dammit, it's live now for sure, wasn't previously, sorry.
Raveren
Ok ive seen it. I get back to u soon.
Colour Blend
Why do you float the divs to the right and left respectively.
Colour Blend
Another thing to know is that the inline styles in you left and right divs will super seed the ones declared in your document. Try it and let me know, what happens.
Colour Blend
While developing I keep the css inline and move it to external files when done. That way it's clearer for me and I don't have to worry about cache.Anyway, your solution is an obvious one, and it of course works. However I did not want the decorations to align to the corners of the browser, but rather to the content. That way, the body would not overlap them. If I don't get an another answer, I'll accept yours, just for your helpfulness :]
Raveren
A: 

The solution in the end was to create a div that opens right after body and encases all content, closing right before body does. The style of the div:

background: url('/client/images/xmas-burbulai.png') no-repeat top center;

The png itself is the two decorations I wanted to be on each side of the body. Both pictures were pasted into one with a 910px empty gap between - the exact width of the body.

No scrollbar, crossbrowser, stylish.

Raveren