2

希望这是一个简单的。在 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;}

小提琴。

4

3 回答 3

5

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

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

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

于 2013-10-29T14:53:27.777 回答
3

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

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 */
于 2013-10-29T14:58:08.677 回答
1

overflow:auto从 .sub-news 和 .first-sub-news中删除您的 s

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

于 2013-10-29T14:56:51.397 回答