html - 移除垂直滚动条

标签 html css scrollbar

我使用 SQL 在 div“col1”中插入了来自数据库的文本。

HTML

<div id="col1">
    <article class="justify" style="width: 100%; min-height: 400px; overflow: auto; margin-top: 0px;">
        <h1>SENASTE ARTIKELN</h1>
        <h3><?php echo $val['title']; ?></h3>
        <h5><?php echo $val['author'] . ', publicerad ' . $val['pubdate']; ?></h5>
        <p><?php echo $val['content']; ?></p>
    </article>

    <p class="right"><a href="articles.php" class="referlink">- Gå till Artiklar</a></p>
</div>

CSS

div#col1 {
    width: 293px;
    float: left;
    padding: 10px 20px;
    text-align: justify;
    overflow: auto;
}

文本显示在一行中,这会导致较长的垂直滚动。我如何删除滚动条并使文本仅出现在“宽度”和自动换行内......?

谢谢!

最佳答案

在 CSS 中试试这个:

word-wrap: break-word;

DEMO

关于html - 移除垂直滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26945466/

相关文章:

php - 我尝试过application/pdf...如何上传pdf?

javascript - html中的普通结束标签和自结束标签

html - 如何使 CSS 表格适合屏幕宽度?

javascript - 如何知道 div 的滚动条何时到达底部 - JQuery

javascript - angularJS如何动态绑定(bind)输入类型日期最大/最小值

html - Bootstrap 动态调整行高

html - 在 Bootstrap 列中垂直居中 DIV 中的内容

javascript - 停止 div 滚动超过设定位置

jQuery 表单对齐插件?

html - 为什么 vw 将滚动条作为视口(viewport)的一部分?