table中的换行问题

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
td{
200px;

}
</style>
</head>
<body>
<div>
<table border="1">
  <tr>
    <th>Poem</th>
    <th>Poem</th>
  </tr>
  <tr>
  	<td style="word-break:break-all">Never increase, beyond what is necessary, the number of entities required to explain anything</td>
    <td nowrap="nowrap"> 甩灯歌互动哥覅和首个hi书hiu回溯法龟速发货GIS皇帝给本科生高考品味偶尔会i搞活动少发货快京哈设定列到付款哈松哈来衡量</td>
    <td>Never increase, beyond what is necessary, the number of entities required to explain anything</td>
  </tr>
</table>
</div>
</body>
</html>

 英文若没有空格的话默认不换行 

汉字和有空格的英文会换行   英文换行会在合适的地方(即某个单词结束后换行)

添加nowrap属性后,不换行

给td添加style="word-break:break-all"英文字母会换行,且不管当前单词是否结束

原文地址:https://www.cnblogs.com/tianhao/p/4302899.html