我需要确保表头的高度是固定的,宽度是根据表头单元格的内容调整的。(标题文本最多显示两行)我们如何使用样式来实现?另外,我希望确保表格行的宽度与标题行的宽度相同(即标题行决定宽度)。
注意:目前交易部门所有者别名是以行的形式出现的。它需要分成两行。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title><link href="Styles/TestStyle.css" rel="stylesheet" type="text/css" /></head>
<body>
<div id = "divForTransactionGrid">
<div>
<table cellspacing="0" rules="all" border="1" id="grdTransactions" style="border-collapse:collapse;">
<thead>
<tr>
<th scope="col">Transaction ID</th><th scope="col">Transaction Name</th><th scope="col">Transaction Owner</th><th scope="col">Transaction Department Owner Alias Name</th>
</tr>
</thead><tbody>
<tr>
<td>1</td><td>TR1</td><td>Lijo</td><td>Lijo</td>
</tr><tr>
<td>2</td><td>TR2</td><td>Lijo</td><td>This is a test value to test the result in real time scenario. Row width should be same as header width</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>CSS
#divForTransactionGrid
{
width: 300px;
height: 250px;
overflow:scroll;
}发布于 2012-04-02 23:26:42
你最大的问题就是崩溃。
Transaction Department Owner Alias Name
但是,让每个空格“”换到一个新行
Transaction Department Owner Alias Name
你所要做的就是在你想让它换行的地方留出一个规则的空格,在你不想让它换行的地方使用,你将有2行或更少的行。对于恰好2行,用换行符而不是换行符“”。祝你好运。
https://stackoverflow.com/questions/9978592
复制相似问题