Wordwrap within css div [closed]

﹥>﹥吖頭↗ 提交于 2019-12-11 02:00:06

问题


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

回答1:


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



回答2:


Add this to your CSS

word-wrap: break-word;


来源:https://stackoverflow.com/questions/19880043/wordwrap-within-css-div

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!