title的内容过长,超过屏幕宽度,如何设置其显示的最大宽度

cnJYGinger 2004-10-09 06:50:50
如题。例如:
<td title="widthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidth">width</td>

当鼠标移上去时,显示的"width..."都在同一行上,超出了屏幕,后面的部分就看不见了。

多谢!
...全文
935 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
yongyou917 2004-10-12
  • 打赏
  • 举报
回复
那么长的内容使用title来显示,不会吧。建议你使用层来做吧。
feifeizaizhe 2004-10-12
  • 打赏
  • 举报
回复
那就没有必要做title了,你就做个层算了
woyingjie 2004-10-12
  • 打赏
  • 举报
回复


几万个字? 完全显示还不吓死人啊~
cnJYGinger 2004-10-12
  • 打赏
  • 举报
回复
情况是这样的,我做的东西是查找,找到的内容可能是一篇文章,但是在查找结果表中不想让它占很大位置,所以在结果表中进行了截取,但我希望能在title中尽量多显示些东西
cnJYGinger 2004-10-11
  • 打赏
  • 举报
回复
这样解决不了问题啊,我的title内容可能有几万个字
cnJYGinger 2004-10-11
  • 打赏
  • 举报
回复
如果在title中没有换行的话倒是可以,不过有了换行以后,做是也可以做,但还要考虑更复杂的情况
老尤 2004-10-11
  • 打赏
  • 举报
回复
你可以这样设置啊:当你鼠标移动上去的时候字体就缩小为原来的多少,多少,就是了,他们都是鼠标移动上去就加大,我们就这样也可以,呵呵~!!!
ghost_lsw 2004-10-10
  • 打赏
  • 举报
回复
left
截取一个字符串的前部分;
格式:left(string,length)
参数:string字符串,length截取的长度.
例子: left(this,3)
结果:thi
cnJYGinger 2004-10-10
  • 打赏
  • 举报
回复
left是什么函数?
tpf9000 2004-10-10
  • 打赏
  • 举报
回复
用Left函数取左边多少个字符不就可以了
left(titlt,10)
cnJYGinger 2004-10-10
  • 打赏
  • 举报
回复
我试过了,还是没用
cnJYGinger 2004-10-10
  • 打赏
  • 举报
回复
这样做会使<td>下的内容拐弯,对title下的有没有作用啊
zhwb36 2004-10-10
  • 打赏
  • 举报
回复
<td style=" word-wrap: break-word;"
title="widthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidth">width</td>

lb2261981 2004-10-10
  • 打赏
  • 举报
回复
我这个是用php的函数实现的。
<td >
<? echo str_replace(chr(10),"<br>",str_replace(" "," ",$title))."<br>"; ?>
</td>
$title 存储title中的内容
cnJYGinger 2004-10-09
  • 打赏
  • 举报
回复
但是在我使用过程中,title中的内容是动态的,由变量提供。而且有换行,等等。如何定位$#13;
有没有简单一点的,例如设个宽度,或者什么wrap函数之类
swlswl27 2004-10-09
  • 打赏
  • 举报
回复
在你需要换行的地方加入:

<td title="widthwidthwidthwidthwidthwi dthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidthwidth">width</td>
场景:在写H5移动端的时候,常常会遇到再顶部有搜索框的情况,如下图: 因为要适应不同的移动设备的屏幕宽度,若将所有的元素宽度写死,更换设备后无论是屏幕宽度增大还是缩小,样式一定会乱掉。因此可以将中间输入框的宽度设置为可变的,即可跟随屏幕宽度的变化而变化,这样就解决的适配的问题。且看示例代码: HTML

61,112

社区成员

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

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