2017-07-08 28 views
0

我使用Bootstrap来获取一些文本和一个按钮,以在屏幕的相对两侧出现在同一行上。我正在使用右键将按钮移到屏幕的右侧,但它只在屏幕宽度很窄时才起作用。如果我将它放大,该按钮会移动到文本旁边。 Here's a JSFiddle example和相关代码:自举拉右只能在很小的宽度上工作

<body> 
    <div class='container-fluid'> 
     <form class="form-inline"> 
      <div class="form-group "> 
       <label>Some Text</label> 
       <button type="button" class="btn btn-primary pull-right">Some Button</button> 
      </div> 
     </form> 
     <div><p>The button only appears on the right side of the window when the width is fairly narrow, even though it has the Bootstrap 'pull-right' class.</p></div> 

    </div> 
</body> 

有没有一种方法在所有宽度拿到按钮向右?道歉,我对Bootstrap和CSS不太了解,所以我确信这是一件容易丢失的事情。此外,对于它的价值,这是一个Electron应用程序,所以它只需要在Chrome中工作。

谢谢。

回答

1

这是因为它被包裹在form group div中,这只是较小视口上的全宽度。你可以摆脱form group,只需在css中创建div width:100%

+1

这样做。非常感谢! – typingm