【问题标题】:How to make a button stay at a fixed position in ASP.NET如何在 ASP.NET 中使按钮保持在固定位置
【发布时间】:2023-03-25 10:41:01
【问题描述】:

在我的网页中,我有以下代码,基本上是一个按钮、两个单选按钮和一个标签,

<tr>
        <td class="primary-BL1" style="text-align:right; width:18%">
            <asp:Button ID="SubmitButton" runat="server" Text="Submit" onclick="SubmitButton_Click" CssClass="button" />
        </td>
        <td class="primary-BL1" style="text-align:left; width:34%">
            <asp:RadioButtonList ID="rblVerification" runat="server" RepeatDirection="Horizontal">
                <asp:ListItem Value="V">Verified</asp:ListItem>
                <asp:ListItem Value="NV">Not Verified</asp:ListItem>
            </asp:RadioButtonList>
        </td>
        <td class="primary-BL1" style="text-align:left; width:48%">
            <asp:Label runat="server" ID="CallReasonMessageLabel" CssClass="required"></asp:Label>
        </td>
    </tr>

当我点击提交按钮时,如果标签显示一些错误信息,按钮的位置会向左移动一点。我应该怎么做才能使按钮保持在固定位置?这只发生在 IE8 中,而不是 IE7。

【问题讨论】:

    标签: asp.net html internet-explorer


    【解决方案1】:

    尝试为第一个单元格设置一个固定宽度,例如200px:

    <td class="primary-BL1" style="text-align:right; width:200px">
        <asp:Button ID="SubmitButton" runat="server" Text="Submit" onclick="SubmitButton_Click" CssClass="button" />
    </td>
    

    如果你对单元格使用百分比,在某些浏览器中它会根据它的内容进行修复

    在其他方面,我建议您使用 div 而不是表格。如果你不擅长 css,你可以使用 css 框架以更干净的方式放置你的项目。我几乎不推荐bootstrap's grid system

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-28
      • 2020-03-30
      • 2014-10-30
      • 2012-12-29
      • 1970-01-01
      相关资源
      最近更新 更多