0

I am currently creating a website and i'm trying to fix the max height to 1100px. However if i try do this i get 2 scroll bars coming up assuming because of the div. Could anyone help me? here is a snippet of my code.

CSS:

html, body {
  border:0;
  margin:0;
  padding:0;
  overflow-x: hidden;
}

#wrap { 
    width: 960px; 
    margin: 0 auto; 
}
4

1 回答 1

1

只需在您的元素上使用该max-height属性。#wrap也可能建议移动该overflow-x属性,并将其更改为overflow-y,或者overflow也可以:

html, body {
    border:0;
    margin:0;
    padding:0;
    overflow-x: hidden;
}

#wrap { 
    width: 960px; 
    margin: 0 auto; 
    overflow: hidden;
    max-height: 1100px;
}

看到这个jsFiddle 演示

编辑:

我已添加overflow-yhtml, body定义中以防止显示默认视口滚动条。

于 2013-07-30T13:58:17.383 回答