如何使用CSS在表格单元格中分割字符串(例如长网址)? [英] How to split a string (e.g. a long URL) in a table cell using CSS?

查看:157
本文介绍了如何使用CSS在表格单元格中分割字符串(例如长网址)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是情况:我正在尝试一些MySpace页面自定义设置。如果您曾经尝试过 [stackoverflow],我相信您知道它会令人沮丧。 >
基本上可以通过CSS在一定的规则集中进行自定义(例如,不允许使用'#'字符...多么有用!)。

博客如果您想了解更多信息,我就用它作为我自定义的基础



因此,唯一的问题是评论部分,朋友发表自己的想法。
它已经有...

  max-width:423px; 

...设置在桌子上,但是我发现注释中是否张贴了长URL部分,不管最大设置如何,它都会炸裂表格宽度!



问题:有没有办法管理要处理的文本

也许是分割字符串呢?或者

URL是文本而不是hrefs。



使用Firefox和Firebug btw。
/ p>

编辑:也不允许使用javascript;)



其他修改刚刚使用IE7进行了检查,它似乎可以正常工作..因此,在这种情况下,firefox变得很麻烦。.

解决方案

一些浏览器支持自动换行



ex。

 < div style = width:50px;自动换行:断字>在此处插入超长字// div; 

浏览器支持当前为IE / Safari / Firefox 3.1(Alpha)


Here's the situation: I'm trying my hand at some MySpace page customisations. If you've ever tried [stackoverflow], I'm sure you understand how frustrating it can be.
Basically it can be all customised via CSS, within a certain set of rules (e.g. the '#' character is not allowed...how useful!).
Have a look at this blog if you want more info, I used it as the basis for my customisations

So the only problem is with the comments section, where 'friends' post whatever they feel like. It already has...

max-width:423px;

...set on the table, but I've discovered if long URLs are posted in the comment section, it blows out the table width, regardless of the max setting!

Question: Is there a way to manage text that is going to push the width of the table?
Perhaps splitting/chopping the string? Or is there more I should be doing..?
The URLs are posted as text, not hrefs.

Using Firefox and Firebug btw.

Edit: Also javascript is not allowed ;)

Another edit Just checked with IE7, and it seems to work.. so firefox is being the hassle in this case..

解决方案

a few browsers support word-wrap

ex.

<div style="width: 50px; word-wrap: break-word">insertsuperlongwordhereplease</div>

browser support currently is IE / Safari / Firefox 3.1 (Alpha)

这篇关于如何使用CSS在表格单元格中分割字符串(例如长网址)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆