XHTML HTML element with 100% height causing scrollbars

后端 未结 6 967
渐次进展
渐次进展 2021-01-17 10:29

In my CSS file I use this:

html,body{height:100%;padding:0;margin:0;border:0;}

Which causes a vertical scrollbar to appear on IE8, Chrome 5

6条回答
  •  时光说笑
    2021-01-17 10:46

    I ran into this issue today and found the scroll bar wasn't caused by a top margin on the first element, but by having BOTH the html and body elements have a height of 100%.

    So, using this CSS rule:

    html,body { height: 100%; }

    I get scroll bars. If I change that to this CSS rule:

    html { height: 100%; }

    I get no scroll bars.

    Peace...

提交回复
热议问题