一个 table 属性问题

lzg0001 2010-06-03 02:06:06


<html>
<head>
<body>
<table width="400" border="0" cellPadding="0" cellspacing="0">
<tr>

<!--td class="recorder" style="font-family:宋体;font-size:21;font-weight:bold;font-style:normal;color:#f83f92;text-decoration:none">
cx-----------------------------------------------------------------------xc
</td-->

<td class="recorder" style="font-family:宋体;font-size:21;font-weight:bold;font-style:normal;color:#f83f92;text-decoration:none">
........................................................................................
</td>

<td width="65px" valign="top" class="datetime2" align="right">13:50:47</td>

</tr>
</table>
</body>
</head>
</html>



用上面那个 td 时显示正常,字符串因为过长自动换行了,但显示下面那个 td 时就出问题了,整个 table 随着 td 一起被撑开了。

为什么?IE 内部显示字符串时还判断字符串内容? 怎么能让第二个 td 和第一个 td 显示同样的效果?
谢谢!
...全文
161 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzg0001 2010-06-03
  • 打赏
  • 举报
回复

非常感谢!

to 4 : 把 ‘.’ 加多一些,并没有解决一长串‘.’自动换行问题;
to 6 : 根本不知道我在问什么 -- 是我的错;

特别感谢 郭大侠 !
郭大侠_ 2010-06-03
  • 打赏
  • 举报
回复
重发:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
</head>
<body>
<table width="400" border="1" cellPadding="0" cellspacing="0" style="table-layout:fixed;">
<tr>

<td class="recorder" style="font-family:宋体;font-size:21;font-weight:bold;font-style:normal;color:#f83f92;text-decoration:none;word-wrap:break-word;">
cx-----------------------------------------------------------------------xc
</td>

<td class="recorder" style="font-family:宋体;font-size:21;font-weight:bold;font-style:normal;color:#f83f92;text-decoration:none;word-wrap:break-word;">
........................................................................................
</td>

<td width="65px" valign="top" class="datetime2" align="right">13:50:47</td>

</tr>
</table>
</body>

</html>
郭大侠_ 2010-06-03
  • 打赏
  • 举报
回复
用下面的代码试试吧。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
</head>
<body>
<table width="400" border="1" cellPadding="0" cellspacing="0" style="table-layout:fixed;">
<tr>

<td class="recorder" style="font-family:宋体;font-size:21;font-weight:bold;font-style:normal;color:#f83f92;text-decoration:none;word-wrap:break-word;">
cx-----------------------------------------------------------------------xc
</td>

<td class="recorder" style="font-family:宋体;font-size:21;font-weight:bold;font-style:normal;color:#f83f92;text-decoration:none;word-wrap:break-word;">
........................................................................................
</td>

<td width="65px" valign="top" class="datetime2" align="right">13:50:47</td>

</tr>
</table>
</body>

</html>
hoojo 2010-06-03
  • 打赏
  • 举报
回复
用这个css属性:
text-overflow : clip | ellipsis
clip : 默认值。不显示省略标记(...),而是简单的裁切
ellipsis : 当对象内文本溢出时显示省略标记(...)
倒霉熊 2010-06-03
  • 打赏
  • 举报
回复
字符串截取下。
fei0668 2010-06-03
  • 打赏
  • 举报
回复
<!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=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.main{
width:960px;
margin:0 auto;
}
.recorder{
width:450px;
color:#f83f92;
line-height:160%;

}
.time{
width:60px;
}
.info{
text-indent:2em;
line-height:150%;
padding:0 5px;
}
-->
</style>
</head>

<body>
<div class="main">
<table width="100%" border="0" cellPadding="0" cellspacing="0">
<tr>

<td valign="top" class="recorder">
cx----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------xc </td>

<td valign="top" class="recorder"><p class="info">
.................................................进入2010年,采用Android系统的机型无疑成为受消费者关注产品,从上市到索尼爱立信X10以及目前人气最为火爆的HTC Desire,每款手机登场似乎都引起了不小的轰动。而今日GPhone阵营再添一员猛将,HTC Incredible目前已到货京城,看来一场新的旗舰之争即将上演。</p></td>

<td valign="top" align="center" class="time">13:50:47</td>

</tr>
</table>
</div>
</body>
</html>


楼主问题以上代码可以解决。单元格内的宽度必需要设定才能对等显示。楼主可以复制以上代码测试!
lzg0001 2010-06-03
  • 打赏
  • 举报
回复
内容是动态确定的
dxsky_sky 2010-06-03
  • 打赏
  • 举报
回复
如果只是为了显示的话,可以中间加个空格就可以换行了.
lzg0001 2010-06-03
  • 打赏
  • 举报
回复
第一个 td 指的是显示“cx-----------------------------------------------------------------------xc
”的那个,第二个指的是显示“........................................................................................
”的。

61,129

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧