SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: A question on containers...
-
Oct 15, 2003, 03:55 #1
- Join Date
- Oct 2003
- Location
- constance, germany
- Posts
- 19
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
A question on containers...
Hi.
I got on <div> positioned absolute on the left side (left: 0); right next to it there is another <div> which I want to automatically be shifted to the right side when the left container is expading its width!
How can I achieve this?
-
Oct 15, 2003, 04:21 #2
- Join Date
- Apr 2003
- Location
- Bath, UK
- Posts
- 353
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I don't think you can, by absolutely positioning the left container you take it out of document flow. This means that it's size and position will not be taken into account when calculating size and position of other page elements so it's size will not have any effect on the right hand element.
You will need to give the left element a specified width, you can then use the same width as the padding on the body or the margin or padding on the right element in order to display it's content in the correct position.
You could left float the left container but you would still need to set a width for it.
Why do you need the left containers width to be non-fixed ?
-
Oct 15, 2003, 04:50 #3
I'm not sure if this might be what you're after, but it's worth posting some code anyway
Code:body { margin: 0; padding: 0; } #left { position: absolute; left: 0; top: 0; width: 40%; } #right { margin-left: 40%; }
HTML Code:<div id="left">This is absolutely positioned and 40% wide.</div> <div id="right"> This block will automatically move when the browser window is resized. </div>
Bookmarks