【问题标题】:Inline Style not applying to asp:checkbox?内联样式不适用于 asp:checkbox?
【发布时间】:2018-09-26 06:31:27
【问题描述】:

内联样式没有应用在 asp:checkbox 中,而是应用到 span?

<td style="width: 100px; height: 25px">
<asp:CheckBox ID="Test" Text="Testing" style="margin-bottom: 2px;"></asp:CheckBox>
</td>

css 适用于 span 而不是特别适用于该复选框。如果我调试浏览器并在那里应用它,它就会生效。

【问题讨论】:

  • 我发现我可以使用 InputAttributes.CssStyle 但它必须在代码后面。有没有办法在标记中使用它?

标签: css asp.net webforms


【解决方案1】:

如果你真的想在标记中使用代码,你可以使用 html 输入:

<input type="checkbox" id="Test1" runat="server" style="margin-bottom: 15px;" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-14
    • 2017-02-25
    • 2019-02-16
    • 2018-07-08
    • 1970-01-01
    • 1970-01-01
    • 2014-01-11
    相关资源
    最近更新 更多