如何在bootstrap

时间:2017-06-24 00:21:48

标签: html css asp.net twitter-bootstrap

我试图将一个asp按钮放在div的正中心。我设法将按钮水平和垂直居中,但不是同时居中。我遇到了其他几个类似的问题,但没有一个解决方案适合我。

        <div class="container" style="border: solid red 1px;">
        <div class="row">
            <span class="col-md-3 Suggestions">Feel free to send any suggestions to the site</span>
            <asp:TextBox ID="Suggestions" CssClass="Suggestions col-md-7 suggestionsBox" runat="server">Enter your suggestions here</asp:TextBox>
            <div class="text-center col-md-2 suggestionsSubmitParent">
                <asp:Button runat="server" CssClass="suggestionsSubmit" Text="Submit" ID="btnSubmit" />
            </div>
        </div>
        <div class="row">
            <span class="col-md-3 suggestionsName">Please enter your name</span>
            <asp:TextBox ID="SuggestionsName" CssClass="col-md-7 suggestionsName" runat="server">Enter your suggestions here</asp:TextBox>

        </div>
    </div>

CSS

.Suggestions {
    text-align:center;
    margin-top: 15px;   
}

.suggestionsBox {
    height: 140px;
}
.suggestionsName{
    margin-top:10px;
}

.suggestionsSubmit {
    width: 80px;
}
.suggestionsSubmitParent {
    height: 155px;
    display: flex;
    align-items: center;

1 个答案:

答案 0 :(得分:0)

justify-content:center;添加到.suggestionsSubmitParent css类。