2017-06-24 86 views
0

我想中心一個asp按鈕在一個div的中心。我設法水平和垂直居中按鈕,但不是同時。我還經歷了其他幾個類似的問題,但沒有一個解決方案適用於我。我如何垂直和水平中心在自舉按鈕asp按鈕

 <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; 
+0

可能重複[如何垂直中心引導類按鈕?](https://stackoverflow.com/questions/22242447/how-can-i-center-vertically-a-bootstrap-class-button) – Junaid

+0

是的,我已經讀過,因爲我沒有說我找到的解決方案正在爲我工​​作 –

+0

您的APP是否存在?我們可以測試它,看看它爲什麼不起作用嗎? – Junaid

回答

0

添加justify-content:center;.suggestionsSubmitParent CSS類。

相關問題