asp.net - 如何左对齐div中的按钮?

标签 asp.net html css

我正在尝试对齐我的 asppanel 中的几个按钮。那么 but1 和 but3 需要左对齐吗?

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style>
        .flo
        {
            float: left;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Panel CssClass="fl0" ID="pnl1" runat="server" Style="background-color: #DDDDDD;
            border: solid 1px black; vertical-align: middle; text-align: center;" Width="120px"
            Height="42px">
            <div style="margin-top: 0px; margin-left: -28px; float:left">
                <asp:Button ID="Button1" runat="server" Text="but1"  />
                <asp:Button ID="Button2" runat="server" Text="but2"  Visible="true" />
                <asp:Button ID="Button3" runat="server" Text="but3"  Visible="true" />
            </div>
        </asp:Panel>
    </div>
    </form>
</body>
</html>

最佳答案

试试这个:

   div style="text-align:left; padding:10px 0 0 0;">
           <div style="padding:3px 0 0 0; height: 36px;">
            <asp:Button ID="Button1" runat="server" Text="but1"  />
            <asp:Button ID="Button2" runat="server" Text="but2"  Visible="true" />
            <asp:Button ID="Button3" runat="server" Text="but3"  Visible="true" />  
  </div>
  </div>

关于asp.net - 如何左对齐div中的按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8497681/

相关文章:

c# - viewmodel 在回发 mvc 5 上返回 null

c# - 如何在数据库的文本字段中存储 byte[] 并检索它

html - 如何设置内容 div 正确对齐?

javascript - 使用动态内容平滑 jScrollPane 滚动条长度调整

html - 具有动画延迟淡入淡出效果的纯 CSS 幻灯片

asp.net - XML 与 SQlite 与 Access

asp.net - 如何在 ASP.NET Razor 中转义 @ 字符

html - slider 背景图像不显示在 ios 移动设备上?

html - 将悬停和单击事件居中并添加到 CSS3 按钮

php - Magento - 类别在目录中显示不正确