Moons
Moons

Reputation: 3854

Fixed positioned Div with dynamic height

I have a Fixed positioned DIV whose content is appended using jquery.

When its height become greater than the screen size i cant see the contents at the bottom of the DIV.

To see the lower down i need to use zoom tool of the browser.

Is it possible that div becomes scrollable if its height increased than a specific limit.

Any help is appreciated.

Upvotes: 1

Views: 2783

Answers (5)

Siverchen
Siverchen

Reputation: 379

just set max-height for the div

*html yourdiv { 
   height: expression( this.scrollHeight > 332 ? "333px" : "auto" ); /* sets max-height for IE */
   overflow:auto;
}
yourdiv{
   max-height: 333px; /* sets max-height value for all standards-compliant browsers */
   overflow:auto;
}

Upvotes: 0

greenLizard
greenLizard

Reputation: 2346

Try something like:

set height: auto; If you want to have minimum height to x then you can write

height:auto;
min-height:30px;
height:auto !important;        
height:30px;

Upvotes: 0

Null Pointer
Null Pointer

Reputation: 9289

Assign a class to div

try this ..

.className
    {
       height:100px;  \* default hight of the div*\
       overflow: auto;    
    }

Upvotes: 0

Dilini Rajapaksha
Dilini Rajapaksha

Reputation: 2708

Use css to get scrolling functionality: overflow: scroll

Upvotes: 0

Jon Newmuis
Jon Newmuis

Reputation: 26492

You can set the max-height CSS property on the div, and it will increase to be no larger than the value you specify. Then set overflow: auto to make it scrollable when content is outside of the viewable area.

Upvotes: 5

Related Questions