2016-12-02 54 views
0

我正在使用引導程序3,並試圖將某個按鈕放在同一行上,但沒有運氣。我做了一個fiddle here。我錯過了什麼?非常感謝。如何將一個按鈕放在與某些文本相同的行上?

<div class="container"> 
<div class="col-xs-12 col-md-6 col-sm-8 col-lg-6 center-block"> 
<br> 
<p>Put the button on the same line as this text.</p> 

<span class="pull-right"> 
<button type="button" class="btn btn-default btn-small" name="submit" id="submit">+ Add Me</button></span> 
<br> 
</div> 
    </div> 

回答

1

我做了一個輕微的改變你將按鈕放在t上的代碼他是同一條線。這是它看起來像現在 -

<div class="container"> 
 
    <div class="col-xs-12 col-md-6 col-sm-8 col-lg-6 center-block"> 
 
    <br> 
 
    <p>Put the button on the same line as this text. <span class="pull-right"> 
 
    <button type="button" class="btn btn-default btn-small" name="submit" id="submit">+ Add Me</button></span></p> 
 
    <br> 
 
    </div> 
 
    </div>

1

創建一個div包含您的按鈕,然後pull-right它:

<div class="container"> 
    <span>Put the button on the same line as this text.</span> 
    <div class="pull-right"> 
    <div class="btn btn-small">+ Add Me</div> 
    </div> 
</div> 

Try it on JSFiddle.

0

試試這個

<div class="container"> 
<div class="col-xs-12 col-md-6 col-sm-8 col-lg-6 center-block"> 
<br> 
<p>Put the button on the same line as this text.</p> 

<span class="pull-right"> 
<button style =" margin-top:0px;" type="button" class="btn btn-default btn-small" name="submit" id="submit">+ Add Me</button></span> 
<br> 
</div> 
    </div> 
相關問題