滚动条出现在我的html页面上

时间:2013-10-29 14:51:39

标签: html css scrollbar

希望这很容易。当我在chrome中查看时,我的网页上出现了滚动条。我认为这是填充或保证金问题,但我无法对其进行排序。有人可以看一下吗?

我的css:

.sub-news {width: 750px; margin: 0 0 20px 0px; padding: 0 0 0 10px; clear: both; overflow: auto; }
.sub-news h3 {font-size: 1em; margin: 5px 0 0 0;}
.sub-news a {background-color: #f39200; padding: 5px; margin: 0 0 10px 0; color: #fff; text-decoration: none;}
.sub-news img {width: 220px; height: 127px;}
.sub-news p {width: 220px;}

.first-sub-news, .second-sub-news, .third-sub-news {width: 240px; float: left; overflow: auto;}

Fiddle.

3 个答案:

答案 0 :(得分:5)

overflow: auto;类中删除.first-sub-news CSS属性。

如果您不希望滚动,也可以在.sub-news课程上。

注意:如果内部的内容大于定义的高度或宽度,overflow: auto;会自动添加滚动条。

答案 1 :(得分:3)

CSS属性overflow确定不适合默认区域的文本会发生什么。将其设置为auto意味着如果它超出边界,它将具有滚动条,否则它将不会。其他可能的设置是:

overflow: visible;  /* Appears over the top of other elements on the page */
overflow: hidden;   /* Anything outside gets cut off */
overflow: auto;     /* Scroll bars appear if needed */
overflow: scroll    /* Scrollbar will always be present, even if there is nothing to scroll */
overflow: inherit;  /* Same as parent */

答案 2 :(得分:1)

从.sub-news和.first-sub-news

中删除overflow:auto

http://jsfiddle.net/YeVXm/1/

相关问题