【发布时间】:2012-01-26 08:47:01
【问题描述】:
我有一个动态创建的表。有时它可以有两列,有时是 20 列。
我的问题是它是否加载了表格的宽度增加。
如何解决?
<div class="rightXMLSubCategory">
<table id = "XMLtable">
<tr>
@foreach(var item in Model.Part.attributes){
foreach(var attr in item.attr_type){
<th>
@attr.name
</th>
}
}
</tr>
<tr>
@foreach(var item in Model.Part.attributes){
foreach(var attr in item.attr_type){
<td>
@foreach(var attrs in attr.attr_value){
@attrs
<br/>
}
</td>
}
}
</tr>
</table>
CSS:
.rightXMLSubCategory
{
text-align:left;
width: 710px;
padding-left: 230px;
}
#XMLtable
{
border-radius:4px;
border: 1px solid #004389;
}
#XMLtable th
{
border-left: 1px solid #0066B3;
border-right: 1px solid #0066B3;
border-bottom: 1px solid #0066B3;
padding:3px 3px 3px 3px;
color: white;
background-color: #004389;
}
#XMLtable td
{
border-left: 1px solid #0066B3;
border-right: 1px solid #0066B3;
border-bottom: 1px solid #0066B3;
padding:3px 3px 3px 3px;
color: white;
background-color: #0066B3;
}
填充的表格:
<table id = "XMLtable">
<tr>
<th>
Product Type
</th>
<th>
Actuator Style
</th>
<th>
Button Color
</th>
<th>
Termination Type
</th>
<th>
Panel Thickness
</th>
<th>
Circuit Breaker Style
</th>
<th>
Current Rating
</th>
<th>
Operating Voltage, Max.
</th>
<th>
Series
</th>
<th>
Brand
</th>
</tr>
<tr>
<td>Circuit Breaker</td>
<td>Push to Reset</td>
<td>Red</td>
<td>6.35 [.250] Straight Quick Connect Tab</td>
<td>0.81 - 1.57</td>
<td>Fuseholder Type</td>
<td>9</td>
<td>32 VDC250 VAC</td>
<td>W28</td>
<td>Potter & Brumfield</td>
</tr>
</table>
【问题讨论】:
标签: css razor html-table