2015-10-06 149 views
0

我得到下面的代码。当我调整浏览器窗口的大小时,按钮会在第二行显示。按钮向下移动

如何将按钮保持在同一行上?

的index.html

<div class="row"> 
     <div class="col-md-7 col-md-offset-3"> 
... 
       <section> 
       <div class="row"> 
        <div class="col-sm-9"> 
        <ul class="nav nav-pills text-center"> 
         <li><a href>Description</a> 
         </li> 
         <li><a href>Specifications</a> 
         </li> 
         <li><a href>Reviews</a> 
         </li> 
        </ul> 
        </div> 

        <div class="col-sm-3"> 
        <button ng-show="product.canPurchase" class="btn btn-primary pull-right buy-btn">Add to Cart</button> 
        </div> 
       </div> 
       </section> 
    ... 
     </div> 
    </div> 

custom.css

@media all and (max-width:480px) { 
    .buy-btn { width: 100%; display:block; } 
} 

调整

enter image description here

之前

调整

enter image description here

后,这是我对最小窗口宽度(完全折叠)

enter image description here

+0

您使用的引导? – j08691

回答

3

你使用<div class="col-sm-9"><div class="col-sm-3">

这意味着wh恩屏幕宽度小于768px这将打破对col-12的

改用<div class="col-xs-9"><div class="col-xs-3">

+0

谢谢,但在这种情况下,当窗口折叠时,按钮不像上一屏截图那样占用全部宽度。 – kirqe

+0

好吧,它可能是全宽,但作为一个col-3它只有25%的行 – stackoverfloweth