【发布时间】:2012-04-16 05:47:07
【问题描述】:
我需要确保表格标题的高度是固定的,宽度是根据标题单元格内容调整的。 (标题文本最多显示两行)我们如何使用样式来做到这一点?另外,我想确保表格行的宽度与标题行的宽度相同(即标题行决定宽度)。
注意:目前“Transaction Department Owner Alias Name”排成一行。它需要分成两行。
<!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;
}
【问题讨论】:
-
你能花点时间把问题的地方稍微修一下吗?
标签: javascript jquery asp.net html css