tags:

views:

203

answers:

4

I have a centered wrapper with following CSS:

div.wrapper {
width: 1170px;
padding-left:30px;
margin-top: 80px;
margin-bottom:20px;
margin-left: auto;
margin-right: auto;
position:relative;  
background-color:black; }

inside i have a div with following css:

position:absolute;
top:-26px;
left:517px;
height:63px;
z-index:3;

inside of this div is an image which has 759px width, that makes the wrapper grow larger and makes the browser show a v-scrollbar on lower display resolutions. what i want is to make the image go outside the wrapper but prevent the browser from showing the scrollbar, so that the right side of the image is only shown if your browser window is large enough and the wrapper keeps its 1200px width. i can't make it a background image because it goes over some of the other content. something that is compatible with >= IE7 would be nice.

i uploaded a pic of the page to show what i mean: http://img153.imageshack.us/img153/6070/hpx.jpg

the blue box is the wrapper, it has 1200px width and is ALWAYS centered in the window (unless then window is smaller than 1200px, then it scrolls) the red box is the image (the green bar is not part of it)

+2  A: 

You are looking for #your_div { overflow: hidden; }, if you want your content to be hidden. Or #your_div { overflow: visible; } if you want your content visible outside the div.

Arko
the problem is, its not really outside the div, the wrapper grows with the inner div if i set overflow to visible, which makes the browser show scrollbars
Aw... okay so you where talkling about the broswer's window scrollbars.I will then start with the wrapper div's width set to be 100% of the window's size, and insuring no content will be larger than that. But you have a bit of work to refactor your css according to this...
Arko
+3  A: 

You can set overflow: hidden to the wrapper so that content that exceeds the dimensions of wrapper will not be shown.

see overflow

rahul
i want the overflow visible, i want the image to show outside the wrapper, but i dont want the browser to show scrollbars because of it
+1  A: 

The only method that springs to mind given your requirements is to move the inner element out of that wrapper div and position it in relation to the entire window:

<body>
  <div class="abs">the div with the image</div>
  <div class="wrapper">the wrapper div</div>
</body>

Unfortunately, this probably means you can't position it very well. You may need to use Javascript to get the width/height of the page and/or the position of the wrapper div, and calculate the offset accordingly. (You'll find questions on Stack Overflow for these bits.)

DisgruntledGoat
A: 

The problem lies with the img being inline. Not tested but you should 'display:block' the image and then float it or absolutely position it.

Rob