简体   繁体   English

溢出:自动提供了一个难看的滚动条,我该如何摆脱它?

[英]Overflow: auto gives an ugly scrollbar, how do I get rid of it?

Ok, so I've been making a website and a problem that I had with it is that the inner div #content wasn't expanding to the full size of the page, letting text flow over in a sloppy manner that made it hard to read over the background image. 好的,所以我一直在创建一个网站,但我遇到的一个问题是内部div #content不能扩展到页面的整个大小,从而使文本以草率的方式流过,从而很难阅读背景图片。 I used overflow: auto; 我用过溢出:自动; to fix my problem, but now there's a scrollbar that I didn't want on the page. 解决我的问题,但是现在页面上不需要我想要的滚动条。 Here's the parts of the CSS that manage the body, html, and #content elements (#content is a div). 这是管理正文,html和#content元素(#content是div)的CSS部分。

body, html {
    height: 100%;
    font-family: Helvetica, Arial, sans-serif;
}
body {
    background-color: black;
    color: white;
    background: url('c12background.jpg');
}
#content {
    height: 100%;
    width: 80%;
    margin: auto;
    padding: 5px 5px 5px 5px;
    background-color: black;
    overflow: auto;
}

Add margin:0; 增加margin:0;

body, html {
  margin: 0;       /* ADD */
  height: 100%;
  font-family: Helvetica, Arial, sans-serif;
}

You dont have to include overflow in your #content , instead add word-wrap in your P tags: 您不必在#content包含overflow ,而在P标签中添加word-wrap

p,a,li{
  word-wrap: break-word;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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