How to specify max-height css property to Screen size

css, html, javascript

Solution

Scroll bar appears only when content is `overflown`.

If `max-height` of your inner div is equal to the height of its container, scroll bar will never appear. if you want to see scroll bar use this.

.scrollDiv {
    height:auto;
    max-height:150%;
    overflow:auto;   
}

Problem

I am trying with the following style: ``` .scrollDiv { height:auto; max-height:100%; overflow:auto; } ``` My Requirement is: - `max-height` of div is equal to screen height - If the content in the div exceeds screen size, then scroll bars should come in div.

Original source

Related problems