【问题标题】:Overflow: auto gives an ugly scrollbar, how do I get rid of it?溢出:自动给出了一个丑陋的滚动条,我该如何摆脱它?
【发布时间】:2016-06-01 01:36:36
【问题描述】:

好的,所以我一直在制作一个网站,我遇到的一个问题是内部 div #content 没有扩展到页面的完整大小,让文本以一种草率的方式流动,导致很难阅读背景图像。 我用溢出:自动;解决我的问题,但现在页面上出现了我不想要的滚动条。 下面是管理 body、html 和 #content 元素的 CSS 部分(#content 是一个 div)。

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;
}

【问题讨论】:

    标签: html css overflow


    【解决方案1】:

    添加margin:0;

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

    【讨论】:

    • 帮忙了,但是溢出问题还是存在
    【解决方案2】:

    您不必在您的#content 中包含overflow,而是在您的P 标签中添加word-wrap

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

    【讨论】:

    • 你可以包含你的 HTML 或者一个 jsfiddle
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-06-21
    • 1970-01-01
    • 1970-01-01
    • 2011-03-15
    • 2018-03-21
    • 1970-01-01
    • 2016-01-12
    相关资源
    最近更新 更多