Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Div Height

Status
Not open for further replies.

ghesse

Programmer
Jun 16, 2003
51
US
Hello,

I have a sidebar that is supposed to span the length of the document on the left side of the document. The problem is I've set the size of the DIV that contains the sidebar to 100% and the table that contains the sidebar code to 100% as well. The sidebar only occupies the viewport initially and if you scroll down the div disappears and I end up with blank space on the left. How do I fix this?

--ghesse
 
I don't quite follow your explanation, but if you wait to size the DIV until the document has completed loading (i.e., call a JavaScript function with the BODY tag's onload event), you can do something like:

divId.style.height = document.body.scrollHeight;

...and that should force your DIV to stretch all the way down.

Obviously, if you knew the exact size you were going to want the DIV to be, you could always set it to a literal value in its STYLE attribute, but if you're like me, you seldom have that luxury.

Good luck.

--Dave
 
ghesse,

I'm not quite sure I get your question right either. However, sounds to me like you're looking for a so called "floating menu" or "static menu" that will float to it's "home position" when you scroll up & down.

If my assumption is correct then have a look at this example I found:


Good Luck


Jakob
 
you can do this with JavaScript and resize the height of the DIV once the page has loaded. This can get a bit messy though.

Or, if your page design/layout will allow it, you can "cheat".
Try making a page background tile that has your menu background colour on one side and your content backgrond colour on the other side.
Then load that into the page background and set it to repeat only in the Y axis using CSS.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top