CSS div中的自动换行 [英] Wordwrap within css div

查看:82
本文介绍了CSS div中的自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am having issues with wordwrapping within my div container. Here is the code for this specific section of code. I want it to automatically wrap to next line even if there are no spaces in the specified line of text.

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

推荐答案

您需要 自动换行:断行 .

jsFiddle示例

#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 div中的自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆