单词包装断词在此示例中不起作用 [英] word-wrap break-word does not work in this example

查看:136
本文介绍了单词包装断词在此示例中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用这个例子的单词包装...

 < html> 
< head>< / head>
< body>

< table style =table-layout:fixed;>
< tr>
< TD风格=自动换行:打破字;宽度:100像素;> ThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrap< / TD>
< / tr>
< / table>

< / body>< / html>



我记得读,一个布局必须指定的(我做了),但除此之外我 m不知道我必须做什么来让这个工作。我真的希望这可以在Firefox中工作。谢谢。



编辑:
在Chrome 19和Firefox 12中失败,它在IE8中工作。
我试过的doctype严格和过渡,既不工作。


解决方案

Mozilla Firefox浏览器的解决方案



添加:

  display:inline-block; 



你的 D 的风格。



基于Webkit的浏览器( Google Chrome Safari ,...) / h2>

添加:

  display:inline-block; 
word-break:break-word;

添加到 td / p>

注意:
请注意,现在, 不是webkit的标准规范的一部分;因此,您可能对使用 break-all 感兴趣。这个替代值提供了一个无疑的激烈的解决方案;但是,它符合标准。



歌剧的解决方案



Add:

  display:inline-block; 
word-break:break-word;



你的 D 的风格。



上一段同样适用于Opera。


I cannot get word-wrap to work with this example...

<html>
<head></head>
<body>

<table style="table-layout:fixed;">
<tr>
<td style="word-wrap: break-word; width:100px;">ThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrapThisStringWillNotWrap</td>
</tr>
</table>

</body></html>

I remembered reading that a layout had to be specified (which I did), but beyond that I'm not sure what I have to do to get this to work. I really would like this to work in Firefox. Thanks.

EDIT: Failed in Chrome 19 and Firefox 12, it works in IE8. I tried doctype strict and transitional, neither worked.

解决方案

Mozilla Firefox solution

Add:

display: inline-block;

to the style of your td.

Webkit based browsers (Google Chrome, Safari, ...) solution

Add:

display: inline-block;
word-break: break-word;

to the style of your td.

Note: Mind that, as for now, break-word is not part of the standard specification for webkit; therefore, you might be interested in employing the break-all instead. This alternative value provides a undoubtedly drastic solution; however, it conforms to the standard.

Opera solution

Add:

display: inline-block;
word-break: break-word;

to the style of your td.

The previous paragraph applies to Opera in a similar way.

这篇关于单词包装断词在此示例中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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