Word-wrap in a html table in mozilla
i have a HTML code its working fine in IE but its not working in Mozilla
please see code below
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
</HEAD>
<BODY>
<TABLE BGCOLOR="#B6EBFF" BORDER="开发者_如何学JAVA3">
<TR>
<TD ALIGN="CENTER" STYLE="WORD-BREAK: BREAK-ALL;">
thisisthetextabcdefghijklthisirrrrrrrrrrrrrrrrrrrsthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijklthisisthetextabcdefghijkl
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" BGCOLOR="FFFEA8">this is the text</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Please Help
found this somewhere in my bookmarks it still just works with white-spaces. Or split the word on a certain character or server-sided.
td
{
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
If you type "AAAAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGGGGGG" this will produce
AARRRRRRRRRRRRRRRRRRRR
RRGGGGGGGGGGGGGGGGGGGG
G
I have taken my example from a couple different websites on google. I have tested this on ff 5.0, IE 8.0, and Chrome 10. It works on all of them.
.wrapword{
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* css-3 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
word-break: break-all;
white-space: normal;
}
<table style="table-layout:fixed; width:400px">
<tr>
<td class="wrapword">
</td>
</tr>
</table>
Word break and word wrap is for separate words, not for single very long word/sequence of characters. I hope this rings some bells for you.
精彩评论