+ -
当前位置:首页 → 问答吧 → DIV被撑开问题

DIV被撑开问题

时间:2011-05-19

来源:互联网

设置的DIV样式,被数据库提前的内容,无情的撑长了,
 原本设置的400PX,被撑长到670PX,word-wrap:break-word;white-space:normal;不管用,有不能使用overflow 来隐藏。

那位有解决方法?谢谢了!

作者: crf_net   发布时间: 2011-05-19

设置输出的文字长度在一定的范围内。

作者: jhrxx   发布时间: 2011-05-19

这个没法设置,一篇文章,2000个字,或多或少。未知的。

作者: crf_net   发布时间: 2011-05-19

严格限制字符长度是个最死的办法,没法限制内容的长度的话试试严格制定div的长,不浮动,绝对位置。

作者: duben4814   发布时间: 2011-05-19

不好使,浮动和绝对定位都会撑开!

作者: crf_net   发布时间: 2011-05-19

请教美工,自动换行!!!

作者: qingYun1029   发布时间: 2011-05-19

固定了div的宽度,应该不会撑长啊!!给代码看看!!!

作者: missgd152   发布时间: 2011-05-19

上代码,长英文不自动换行,数据库中提取出的也不能是长段的英文吧,可能是数据库提取的文字中是不是有样式或者是其它的html代码。然后把html代码格式化在试试

作者: coecs110   发布时间: 2011-05-19

这样的就可以。
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;
    padding:0px 15px 0px 10px;
}
</style>
</head>

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


作者: xiaoxiaoo7   发布时间: 2011-05-19

但是换成纯英文字母的就不可以。HTML code
<div id="pagebodymain">
  <div class="page_left">fffff</div>
<div class="page_right">
fffffddd</div>

作者: xiaoxiaoo7   发布时间: 2011-05-19