2016-05-06 48 views
1

傢伙喜中間我有2個按鈕現在:使按鈕出現在頁面引導

<a href="GAME1/index.html" class="btn btn-warning" style ="margin-left: 500px;">1 Player</a> 
    <a href="GAME4/index.html" class="btn btn-warning">2 Players</a> 

努力使他們出現在我的頁面的中間,但我相信使用像與容限左500px是不好的編碼,我想知道什麼是讓他們出現在頁面中間,也是1上面的最好方法,並改變按鈕的大小,使他們更大一點

謝謝尋求幫助

回答

1

包裹在一個div兩個按鈕,像這樣

<div style="text-align:center"> 
    <a href="GAME1/index.html" class="btn btn-warning">1 Player</a> 
    <a href="GAME4/index.html" class="btn btn-warning">2 Players</a> 
</div> 

如果你希望他們在另一個之上,添加style="display: block;"到每個按鈕。要更改字體大小,請將font-size添加到您的內聯樣式中。

所以現在:

<div style="text-align:center"> 
    <a href="GAME1/index.html" class="btn btn-warning" style="display:block; font-size: 20px;">1 Player</a> 
    <a href="GAME4/index.html" class="btn btn-warning" style="display:block; font-size: 20px;">2 Players</a> 
</div> 
1

引導附帶了一個名爲 「文本中心」 類。
這將使div和其中的任何內容居中。

<div class="text-center"> 
    <a href="GAME1/index.html" class="btn btn-warning" style ="margin-left:  500px;">1 Player</a> 
    <a href="GAME4/index.html" class="btn btn-warning">2 Players</a> 
</div>