2017-02-04 21 views
-1

如何將此按鈕放在一行中?一行中的兩個按鈕

<form method="post"> 
    <button type="submit" name="render_button" class='btn btn-block btn-primary' style="width:100px;height:30px;" > Render </button> 

    <button type="submit" name="check" class='btn btn-block btn-primary' style="width:100px;height:30px;" > Render2 </button> 
</form> 
+2

從你給的代碼,它們都在同一條線上。 –

+0

這是在Bootstrap中,對嗎? –

+0

^bootstrap具有'.form-inline'不是嗎? – Chay22

回答

1

如果使用自舉,其我被BTN BTN-主標籤猜測,只需添加顯示:內聯塊;對每個樣式標記:

注意:您可能必須在第二個按鈕的邊距頂部0,我也將添加。

<form method="post"> 
     <button type="submit" name="render_button" class='btn btn-block btn-primary' style="width:100px;height:30px;display:inline-block;" > Render </button> 

     <button type="submit" name="check" class='btn btn-block btn-primary' style="width:100px;height:30px;display:inline-block;margin-top:0;" > Render2 </button> 
</form> 
1

我覺得btn-block類是你的罪魁禍首,如果你刪除它的按鈕應顯示爲在線元件

<form method="post"> 
    <button type="submit" name="render_button" class='btn btn-primary' style="width:100px;height:30px;" > Render </button> 

    <button type="submit" name="check" class='btn btn-primary' style="width:100px;height:30px;" > Render2 </button> 
</form>