java取消换行,CSS强制换行...竟然忘记了....汗!
java 取消换行代码
- public class Formatter {
- public static void main(String...args) {
- try
- {
- BufferedReader reader = new BufferedReader(new FileReader("D://in.txt"));
- String sReadLine = reader.readLine();
- StringBuilder sAllContext = new StringBuilder();
- while(sReadLine!=null)
- {
- sAllContext.append(sReadLine);
- sReadLine = reader.readLine();
- }
- reader.close();
- PrintWriter pw = new PrintWriter(new FileOutputStream("D://out.txt"));
- pw.println(format(sAllContext.toString()));
- pw.close();
- }
- catch(Exception e){
- e.printStackTrace();
- }
- }
- static String format(String str){
- String reStr = str.replaceAll("\t", " ");
- reStr = reStr.replaceAll("\r\n", " ");
- return reStr;
- }
- }
CSS强制换行代码
- ->div 便签解决方法
-
- white-space:normal; word-break:break-all;这里前者是遵循标准。
- (如果直接加在TD 则:style=" word-break: break-all;")
- #wrap{white-space:normal; width:200px; }
- 或者
- #wrap{word-break:break-all;width:200px;}
-
- < div id=" wrap " width="80">将我换行< /div>
-
- ->table 标签解决方法
-
- < style>
- .tb{table-layout:fixed}
- < /style>
-
- < table class="tbl" width="80">
- < tr>< td>将我换行 < /td>< /tr>
- < /table>
-
- < table class="tb" width="80">
- < tr>< td nowrap>将我换行< /td>< /tr>
- < /table>
-
- < table class="tb" width=80>
- < tr>
- < td width=25% nowrap>将我换行< /td>
- < td nowrap>将我换行< /td>
- < /tr>
- < /table>