SoFunction
Updated on 2025-02-28

css force line break css force line break css force line break css method

I have summarized the writing methods of Div's newline and non-line css. But only knowing one property for table cells nowrap can make it not wrap.

I have this need recently, but I found that with nowrap, it will still be a newline in some cases! Helpless, is there no way to force not to wrap lines?

I was very pleased after baidu for a while, and I really found a solution and the problem was solved.

Use CSS to realize automatic or non-line wrapping of table cell data

1. Automatic line wrap:

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]


2. No line breaks:
Copy the codeThe code is as follows:

<style type="text/css"> 
.NoNewline 

word-break: keep-all;/*must*/

</style>  

<table> 
<tr> 
<td class="NoNewline">No line breaks, no line breaks, no line breaks, no line breaks, no line breaks, no line breaks, no line breaks, no line breaks, no line breaks, no line breaks</td>
</tr> 
</table>