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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

divs height and scrollbar

Status
Not open for further replies.

johnnypea

Technical User
Oct 31, 2009
1
0
0
SK
I would like to ask you for a help...

<div id="1"></div>
<div id="2"></div>

...content in div1 (main content) is changing so its height is dynamical
...content in div2 (sidebar) is not changing but it's like a long list and when there is very short text in div1 it doesn't look good when div2 standing side by side with div1 is very long

I know almost nothing about js and I think I can do this only with js...when height of div1 is the same or more than div2 I want no scrollbar there but if div1's height is less than div2 I want there scrollbar in div2(it could be generated with css) so their height would be the same

I hope you understand my crappy English(really sorry for my language). Thank you in advance

 
Use CSS. Add a height style to the div1 (and add overflow auto to it to show a scroll bar if the content is gong to be more than the height).

No javascript needed.

Cheers,
Jeff

[tt]Visit my blog [!]@[/!] Visit Code Couch [!]@[/!] [/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top