在gridview中强制行高

时间:2017-07-02 19:57:53

标签: html css gridview

我的项目模板中有一个带有模板字段和标签的GridView。通过CssClass将高度设置为12px。 (线高度= 12像素;高度= 12像素)。一切都按照我期望的方式运作。

一旦我提供了TextBox的可见性,即使我将文本框的高度降低到假设的5px,行高也会增加大约每行1px。

<asp:templatefield HeaderText="Result" ItemStyle-HorizontalAlign="center">
    <ItemTemplate>
        <asp:Label runat="server" Text='<%# Bind("Result") %>' id="LabelResult" CssClass="NarrowGrid" visible="false"/>
        <asp:TextBox runat="server" id="TextBoxResult" Height="5px"  Width="25px" Visible="true" CssClass="NarrowGrid"/>
    </ItemTemplate>
</asp:templatefield>

在这两种情况下,如何实现/强制12px为行高?

1 个答案:

答案 0 :(得分:0)

input{
   height: 12px;
   padding: 0;
   margin: 0;
}

希望它有所帮助