【问题标题】:not able to align radiobuttonlist无法对齐单选按钮列表
【发布时间】:2016-01-06 20:38:58
【问题描述】:

我无法将单选按钮列表对齐到上方标签的左侧。 这是代码

  <div style="border-radius: 10px;">
        <div style="margin-bottom: 10px"></div>
        <asp:Panel ID="panel" runat="server">
            <div style="padding-left: 10px" >
                <asp:Label ID="lbl" runat="server" Text="Select criteria" />
                <asp:RadioButtonList ID="radio" runat="server" AutoPostBack="True" OnSelectedIndexChanged="radio_SelectedIndexChanged" RepeatDirection="Horizontal"   />
                <asp:Label ID="lbl1" runat="server" Text="Value"></asp:Label>
                <br />
                <asp:TextBox ID="txt" runat="server"></asp:TextBox>
                <asp:Label ID="ScoreMethodLabel" runat="server" Text="Score"></asp:Label>
                <asp:DropDownList ID="dropscore" runat="server" />&nbsp;
            </div>

        </asp:Panel>
        <br/>
    </div>

这是我看到的输出

您会看到选项按钮未完全对齐在名为“选择条件”的文本下方

【问题讨论】:

  • 右键单击单选按钮,检查元素(至少在 chrome 上)并将鼠标悬停在检查器面板中的元素上 - 然后检查元素是否显示任何橙色/紫色,如果这是真的,橙色表示边距,紫色表示填充。然后你可以继续在你的 CSS 中重置它
  • @SidneyLiebrand 我看到橙色,但即使我添加了边距,它也没有对齐
  • @SidneyLiebrand 当我使用 F12 打开 html 时。然后它呈现为输入类型=收音机,当我添加边距:0 然后它工作。但不是当我直接在 asp:radiobuttonlist 上添加属性 margin:0
  • 这里有一个类似的问题stackoverflow.com/questions/7767812/…
  • @शेखर 那不是我想要的。我想将选项按钮对齐到上方标签的左侧。

标签: html css asp.net radiobuttonlist


【解决方案1】:

尝试margin:0

* {
   margin: 0;
   }

input[type=radio] {
        margin: 0;
   }

【讨论】:

  • 没有区别
  • 我这样添加
  • 没有区别。但是当我使用 F12 打开 html 时。然后它呈现为输入类型=收音机,当我添加边距:0 然后它工作。但不是当我直接在 asp:radiobuttonlist 上添加属性 margin:0
  • 我还在样式表中添加了您的代码,但没有改变任何内容
  • 请记住,在我的单选按钮列表中,repeatdirection 设置为 horiziontal .. 这有什么不同吗?
猜你喜欢
  • 2012-12-31
  • 2013-03-09
  • 2013-04-18
  • 2012-04-12
  • 1970-01-01
  • 2014-08-20
  • 2011-05-12
  • 2021-01-20
  • 1970-01-01
相关资源
最近更新 更多