简体   繁体   中英

Scrollbar goes down the page

I have a jsp page where html code has been used with divs;I want to add scrollbar in all cases, so i have used this css code:

<body style="overflow: scroll; height : 90%">

a scroll bar is displayed in all case but it goes down the page i cant see the down icon of scroll bar, It works fine in chrome but not in IE.Please help me in solving this issue.

Thanks,

Raj

You see.. element 90% is always going to be 90% in case you set max-height;

<body>
<div style="overflow: scroll; height : 90%; max-height:500px">

Because if screen height is 1000px body tag = 900px, if you resize screen to 500px body will be 90% of 500px = 450px; always resizing. so after you set max height ( and probably you should set min-height depends what results you need ) if screen height will be 1000, but body max-height will be 500px it will become scrollable element.

And yea.. I checked first before posting here, so as you see to get work you should set to element like div (or other which contains display:block; ) to get it work :) Hope I helped to solve problem, if yes, click solved + rep thanks :)

if you want to scroll vertically only you should try

overflow-y:scroll

html {
  overflow-y: scroll;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM