0

我有以下代码

        <div class="well sidebar-nav">
        <ul class="nav nav-list">
            <li class="nav-header-myLeagues">Create A New League</li>
            <li class="divider"></li>
            <li class="li-myLeagues">
                <asp:Label ID="LeagueNameLabel" runat="server">League Name:</asp:Label></li>
            <li class="li-myLeagues">
                <asp:TextBox ID="LeagueNameTextBox" runat="server"></asp:TextBox>
                <asp:Button ID="SubmitNewLeagueButton" CssClass="btn btn-primary" runat="server" CommandName="SubmitNewLeague" Text="Submit" />
            </li>
        </ul>
    </div>

由于某种原因,按钮与文本框不完全一致,有什么想法吗?

4

2 回答 2

3

尝试将您的CSS如下所示

.li-myLeagues li
{
     display: inline;
      list-style-type: none;
     padding-right: 20px;
     float: left;
}

这将是有用的......

这里是我为你做的一样的东西..

于 2013-03-04T11:27:34.863 回答
1

将文本框和按钮包装进去<div></div>,并将 css float:left 设置为 div

<li class="li-myLeagues">
    <div style="float:left">
        <asp:TextBox ID="LeagueNameTextBox" runat="server"></asp:TextBox></div>
    <div style="float:left;margin-left:10px;">
            <asp:Button ID="SubmitNewLeagueButton" CssClass="btn btn-primary" runat="server" CommandName="SubmitNewLeague" Text="Submit" />
</div>        
</li>

将css添加到类.li-myLeagues

.li-myLeagues
{
display:inline-block;
float:left;
}
于 2013-03-04T11:30:05.933 回答