---
title: "让表格不自动扩展"
author: "bepatient"
date: "2011-02-06T20:20:40Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2011-02-06T20:20:40Z"
id: 901373
url: "https://bepatient.iteye.com/blog/901373"
---

```
<style type="text/css">
<!--
td { word-wrap: break-word; word-break: break-all; }
-->
</style>
<table width="500" border="1" cellspacing="1" cellpadding="1">
<!--table width="30%" border="1" cellspacing="1" cellpadding="1"-->
  <tr>
  <td>AAAA</td>
  <td width=300>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  </td>
  <td>aaa</td>
  </tr>
  <tr>
  <td>BBBB</td>
  <td>xxxx</td>
  <td>bbbb</td>
  </tr>
</table> 
```

 表格td中的在不设置表格宽度或者表格宽度小于实际占用时会自动将表格扩展，不会自动换行

nowrap表示不换行，如果行的宽度不设置或者小于实际的宽度，则会将单元格撑宽，而不会换行