【发布时间】:2013-10-09 12:57:36
【问题描述】:
我需要一个网络表单上的表格,其中包含一个可编辑的列。
我尝试了一个 HTML 表格,但使用 tbody{height:150px; overflow:auto;} 后发现,将列标题与正文中的列对齐很困难,而在正文中使用 <input> 标记更难。此外,<input> 在<table> 中的宽度是不可更改的; size 选项是关于文本框中允许的字符数。
我尝试了 DevExpress,但很难获得一个可编辑的列。
现在我正在尝试使用 ASP Gridview,但发现很难微调布局。这是我的新 App_Themes 中的 CSS:
table#GridView_Samples
{
table-layout:fixed;
border:1px solid grey;
}
table#GridView_Samples th
{
font-family:Verdana;font-size:11px; font-style:normal;
}
table#GridView_Samples td
{
font-family:Verdana;font-size:11px; font-style:normal;
border:1px solid lightgrey;
padding: 0px, 5px 0px, 5px;
}
字体更改正确,只是列标题仍然是粗体,并且填充不起作用。
会不会是失败的 CSS 选项被 Microsoft 默认主题设置否决了?而且,一般来说,不可能微调 ASP 控件的所有方面?
编辑:这是html输出的片段(手工漂亮):
<table cellspacing="0" rules="all" Mode="NumericFirstLast"
border="1" id="GridView_Samples"
style="border-collapse:collapse;">
<tr>
<th scope="col">Project</th>
<th scope="col">Monster</th>
<th scope="col">Omschrijving</th>
<th scope="col">% Lutum (gemeten)</th>
<th scope="col">% Org.Stof (gemeten)</th>
<th scope="col">% Lutum (toetsing)</th>
<th scope="col">% Org.Stof (toetsing)</th>
</tr>
<tr>
<td style="width:60px;">P-0002</td>
<td style="width:60px;">S-01</td>
<td style="width:150px;">Sample 01</td>
<td style="width:60px;">4</td>
<td style="width:70px;">20</td>
<td style="width:60px;">
<input name="GridView_Samples$ctl02$TextBoxLutum" type="text"
id="GridView_Samples_TextBoxLutum_0" style="width:60px;" />
</td>
<td style="width:70px;">
<input name="GridView_Samples$ctl02$TextBoxOrganicMatter" type="text"
id="GridView_Samples_TextBoxOrganicMatter_0" style="width:70px;" />
</td>
</tr>
【问题讨论】:
-
你试过
!important吗? -
这是一个 ASP 选项吗?如何使用它? (很难谷歌)
-
这在 css 中:
th { font-style: normal !important; } -
如果此时您发现有很多困难,那么基于 ASP 网格的应用程序可能不是一个好的起点。
-
网格在 HTML 中是如何呈现的?请提供 HTML 示例。没有相应的 HTML 几乎不可能调试 CSS