Jump to content

[SOLVED] Width Auto Ajust


The Little Guy

Recommended Posts

I have 3 divs, one is a container, and two are positioned absolute.

 

the one on the left is 350px wide, but the other one should expand to fit the rest of the page.

 

if you look here, it is the right div that messes it all up. On some screens it is too wide, some it is too small, and some it fits just right. Basically there is supposed to be about a 20px margin between the white and your browsers edge. So how can I fix this?

Link: http://www.wtf.publicsize.com/

 

Here is my CSS:

#container{
width:100%;
}
#left{
width:330px;
min-height:356px;
background-image:url('/images/left.jpg');
background-repeat:no-repeat;
background-position:1 0;
top:370px;
left:20px;
}
#right{
width:71%;
min-height:456px;
top:270px;
left:350px;
}
#right, #left{background-color:#FFF;position:absolute;}

 

And here are my three divs:

<div id="container">
	<div id="left">
	</div>
	<div id="right">hi
	</div>
</div>

Link to comment
Share on other sites

here is an example:

 

<style>
#container{
   position: relative;
   padding-left: 350px;
}
#left{
   position: absolute;
   left: 0px;
   width: 330px;
   height: 500px;
   background: blue;
}
#right{
   height: 500px;
   background: red;
}
</style>
<div id="container">
   <div id="left"></div>
   <div id="right"></div>
</div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.