我在我的项目中使用下面的代码来换行文本,但文本仍然溢出到下一个文本框。我也尝试过使用word-wrap:break-all
,但它不起作用。我正在使用Chrome来测试我的代码。
在这种情况下,有没有人能建议我应该用什么来换行?
代码
<td style="word-wrap:break-word" <%if((sv.ownername).getClass().getSimpleName().equals("ZonedDecimalData")) {%>align="right"<% }else {%> align="left" <%}%> ><%=smartHF.getHTMLOutputFieldSFL(sv.ownername, "ownername", 0)%></td>
发布于 2017-03-15 16:32:25
添加这个
word-break: break-all;
white-space:normal;
发布于 2017-03-15 16:33:58
您可以使用此html
<table width="100" border="1" style="table-layout:fixed">
<tr>
<td><div style="word-wrap:break-word"> 23232323232323232323232323232323232323232323232323</div></td>
<td>abcabc</td>
</tr>
</table>
发布于 2017-03-15 16:42:07
您应该为文本定位器提供宽度,以便自动换行可以正常工作
p.test {
width: 100px;
border: 1px solid #000000;
word-wrap: break-word;
}
<table>
<tr>
<td>
<p class="test"> I am using below code in my project for wrapping the text but the text is still overflowing to the next text box. I also tried using word-wrap:break-all but it did not work. I am using Chrome to test my code.</p>
</td>
</tr>
</table>
https://stackoverflow.com/questions/42804262
复制相似问题