版权声明:本文为博主原创文章,转载注明地址:http://blog.csdn.net/wang704987562 https://blog.csdn.net/wang704987562/article/details/81810460
当表格内容是英文单词时,默认不会换行
解决方法:给table设置table-layout: fixed; table下的td设置word-wrap: break-word;
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>内容换行问题</title>
<style>
table {
border-collapse: collapse;
table-layout: fixed;
width: 310px;
}
table td {
border: solid 1px #fab;
width: 100px;
word-wrap: break-word;
}
</style>
</head>
<body>
<table>
<tr>
<td>1</td>
<td>Lorem Ipsum</td>
<td>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </td>
</tr>
<tr>
<td>2</td>
<td>LoremIpsumhasbeentheindustry'sstandarddummytexteversincethe1500s,whenanunknown</td>
<td>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</td>
</tr>
<tr>
<td>3</td>
<td></td>
<td>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna...</td>
</tr>
</table>
</body>
</html>
效果
解决.