tags:

views:

760

answers:

2

I want a two column layout where the two columns are proportional in size to each other and won't overlap. The left column has only a little bit of content in the top of it and should scroll down with the page (float along with the page as it scrolls down.) The right column will have a lot of data and won't have a scrollbar, the browser will scroll down the page.

So I want to combine the two examples below so that when the font is resized and the content changes, the columns remain proportional like they are in Example 2, but I also need the left side content to follow the user down the screen as they scroll to see all of column 2 (as it does in Example 1).

Please see the example here to see what I am talking about:

http://vershok.com/test_layout_20090610.html

I've updated the example with a JQuery UI calendar in the left div to show how position: fixed; layouts don't resize the right column correclty (the JQuery calendar has issues because it overflows its div.)

http://vershok.com/test_layout2_20090610.html


I want a two column layout where the two columns are proportional in size to each other and won't overlap. The left column has only a little bit of content in the top of it and should scroll down with the page (float along with the page as it scrolls down.) The right column will have a lot of data and won't have a scrollbar, the browser will scroll down the page.

+2  A: 

If you use DIVs to split the page, you can achieve this effect, like so:

<div style='position: fixed;width: 20%;'>
  Text for the left column.
  Should scroll down the page
</div>
<div style='float: right; width: 80%;'>
  *insert large content here. including table content if you want.*
</div>
Marshall
I updated the example with a jquery calendar in the left hand-side:http://vershok.com/test_layout2_20090610.htmlIn this case the table layout will resize the 2nd right column based on the size of the calendar, but the position: fixed; layout will not force a resize of the right column and the calendar will overflow the right column.
MikeN
The width of 20%/80% is just a sample size. If the desired size of the left column is known at design time, you can adjust the width accordingly.
Marshall
Hi Marshall, my problem is that on different screen sizes and font settings the JQuery calendar will overflow its div an take up more than x% of the screen. I want the right hand column to resize as the left hand side gets bigger so there is no overlap.
MikeN
+1  A: 

An element with position:fixed is basically an absolutely positioned element, positioned relative to the browser window.

This means it is removed from the flow of the document and will not affect how the elements before or after it are positioned (or sized). That is why your left column is not changing width when the fixed position element is too wide.

You should be aware that ie6 does not support position:fixed and defaults back to position:static. ie7 only supports position:fixed if you are using a strict doctype.

Emily