css - css div 中的自动换行

标签 css html word-wrap

<分区>

我的 div 容器中的自动换行有问题。这是此特定代码部分的代码。我希望它自动换行到下一行,即使指定的文本行中没有空格。

#content {
    position: justify;
    font-size: 10px;
    font-family: Times new roman;
    width: 80%;
    padding: 10px 10px 10px 10px;
    height: auto;
    overflow-x: auto;
    color: #000;
}

最佳答案

你需要word-wrap:break-word .

jsFiddle example

#content {
    word-wrap: break-word;
    position:justify;
    font-size: 10px;
    font-family: Times new roman;
    width: 80%;
    padding: 10px 10px 10px 10px;
    height: auto;
    overflow-x: auto;
    color: #000;
}

关于css - css div 中的自动换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19880043/

相关文章:

html - 视频标签 src 没有选择 ftp url 作为源?

html - CSS 验证问题 : Not allowed div element in a tags

html - 如何为列表中的元素添加背景颜色

javascript - 报价和自动换行

html - Rails - 电子邮件字符串拒绝在表格内自动换行

html - 我在 head 元素中的 CSS 不工作

javascript - 使用动态高度调整 div 内的 Div 大小

html - 将长电子邮件地址包装在小盒子中

jQuery .mouseenter 不适用于绝对定位。

javascript - 如何检测单个字母并修改它们的外观/CSS