+ -
当前位置:首页 → 问答吧 → 请教css控制英文断字问题

请教css控制英文断字问题

时间:2011-06-17

来源:互联网

<td width="565" ><span class="hang"><div><%=rs.getString("fContent")%></div></span></td>
rs.getString("fContent")是一个文章,但在输出时总会出现英文断字问题,即一个单字中的几个字母在上一行,另外的字母却在另一行,
求教:如行让位置不够的单词整个移到下一行。

作者: myisfei   发布时间: 2011-06-17

方向错了,感觉这种情况不应该用css,至多用JS。
html可以自动判断英文断字的。你把rs.getString("fContent")值作为字符串赋给一个js的变量,然后document.write这个变量试试,也许就不会有问题了,另外既然是段落,把div换成p多好。

作者: brainwkernighan   发布时间: 2011-06-17

引用 1 楼 brainwkernighan 的回复:
方向错了,感觉这种情况不应该用css,至多用JS。
html可以自动判断英文断字的。你把rs.getString("fContent")值作为字符串赋给一个js的变量,然后document.write这个变量试试,也许就不会有问题了,另外既然是段落,把div换成p多好。

dicument.write的位置很不好控制的吧,我要在某个<td>中显示如何做到呢?

作者: myisfei   发布时间: 2011-06-17

也许不该用<span>吧!

作者: yanglin1122   发布时间: 2011-06-17

引用 3 楼 yanglin1122 的回复:
也许不该用<span>吧!

这不是重点吧,span是我用来引用css而加入的,我现在的问题是断字问题

作者: myisfei   发布时间: 2011-06-17

HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
html {
    padding:0px 0px 0px 0px;
    margin:0px auto;
}
body {
    font-size:12px;
    text-align:center;
    margin:0px auto;
    padding:0px 0px;
    width:1003px;
    color: #004120;
}
.page_left {
    width:186px;
    float:left;
    padding-left:5px;
    margin:0px auto;
}
.page_right {
    float:right;
    width:710px;
    line-height:20px;
    text-align:left;
}
.page_middle {
    float:right;
    width:710px;
    line-height:20px;
    text-align:left;
    margin:15px 0px;
    word-wrap:break-word;
    overflow:hidden;
}
</style>
</head>

<body>
<div id="pagebodymain">
  <div class="page_left">AngelWing  International Trading Co.,Ltd,</div>
<div class="page_right">
anotherAngelWing anotherAngelWing anotherAngelWing anotherAngelWing anotherAngelWing anotherAngelWing  anotherAngelWing anotherAngelWing anotherAngelWing anotherAngelWing anotherAngelWing   </div>
 </div>
 <div class="page_middle">anotherAngelWinganotherAngelWing </div>
 </div>
</div>
</body>
</html>

上面两个例子,一个page_right是单词间有空格的,它都会自动换行。一个page_middle间单词间是没有空格的才会导致单词断开。可是正常的应该是单词间都有空格才是吧。所以没遇到那情况。也不好判断。呵呵,不对之处还请见谅咯。。。

作者: xiaoxiaoo7   发布时间: 2011-06-17


<td width="565" ><span class="hang"><div style="word-wrap:break-word
"><%=rs.getString("fContent")%></div></span></td>

作者: calmcrime   发布时间: 2011-06-17

热门下载

更多