2017-03-16 61 views
1

問題發生在阿爾法6但不阿爾法5自舉4個標籤不卷繞

在自舉3個標籤將換到下一行,以便它們可以在更小的屏幕尺寸來使用。

在自舉4他們不包裹和戳關閉屏幕的一側。這是Bootstrap 4文檔的例子。

我如何讓它在引導3換什麼樣的?

#viewport 
 
{ 
 
    width: 200px; 
 
    border: 1px solid #000; 
 
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"> 
 

 
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script> 
 

 
<div id="viewport"> 
 
<!-- Nav tabs --> 
 
<ul class="nav nav-tabs" role="tablist"> 
 
    <li class="nav-item"> 
 
    <a class="nav-link active" data-toggle="tab" href="#home" role="tab">Home</a> 
 
    </li> 
 
    <li class="nav-item"> 
 
    <a class="nav-link" data-toggle="tab" href="#profile" role="tab">Profile</a> 
 
    </li> 
 
    <li class="nav-item"> 
 
    <a class="nav-link" data-toggle="tab" href="#messages" role="tab">Messages</a> 
 
    </li> 
 
    <li class="nav-item"> 
 
    <a class="nav-link" data-toggle="tab" href="#settings" role="tab">Settings</a> 
 
    </li> 
 
</ul> 
 

 
<!-- Tab panes --> 
 
<div class="tab-content"> 
 
    <div class="tab-pane active" id="home" role="tabpanel">...</div> 
 
    <div class="tab-pane" id="profile" role="tabpanel">...</div> 
 
    <div class="tab-pane" id="messages" role="tabpanel">...</div> 
 
    <div class="tab-pane" id="settings" role="tabpanel">...</div> 
 
</div> 
 

 
</div>

(黑色輪廓顯示小視口。在以前的版本標籤會換到新的生產線,因此所有將是可見的黑線內)

回答

4

導航標籤,像其他組件現在是Flexbox的。只需使用flex-wrap即可。

<ul class="nav nav-tabs flex-wrap" role="tablist"> 
     <li class="nav-item"> 
      <a class="nav-link active" data-toggle="tab" href="#home" role="tab">Home</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" data-toggle="tab" href="#profile" role="tab">Profile</a> 
     </li> 
     ... 
</ul> 

http://www.codeply.com/go/hGPyyOv76W

我不認爲這是一個 「問題」,而是 「設計」。

另一種可能更具響應性的方法是使用flex-column,但僅限於xs寬度。這種方式是垂直堆疊而不是纏繞。

<ul class="nav nav-tabs flex-column flex-md-row" role="tablist"> 
     <li class="nav-item"> 
        <a class="nav-link active" data-toggle="tab" href="#home" role="tab">Home</a> 
     </li> 
     <li class="nav-item"> 
        <a class="nav-link" data-toggle="tab" href="#profile" role="tab">Profile</a> 
     </li> 
     ... 
</ul> 

Demo

0

似乎是具體的問題要引導的第4版使用的是:

#viewport 
 
{ 
 
    width: 200px; 
 
    border: 1px solid #000; 
 
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha/css/bootstrap.min.css" crossorigin="anonymous"> 
 

 
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha/js/bootstrap.min.js" crossorigin="anonymous"></script> 
 

 
<div id="viewport"> 
 
<!-- Nav tabs --> 
 
<ul class="nav nav-tabs" role="tablist"> 
 
    <li class="nav-item"> 
 
    <a class="nav-link active" data-toggle="tab" href="#home">Home</a> 
 
    </li> 
 
    <li class="nav-item"> 
 
    <a class="nav-link" data-toggle="tab" href="#profile">Profile</a> 
 
    </li> 
 
    <li class="nav-item"> 
 
    <a class="nav-link" data-toggle="tab" href="#messages">Messages</a> 
 
    </li> 
 
    <li class="nav-item"> 
 
    <a class="nav-link" data-toggle="tab" href="#settings">Settings</a> 
 
    </li> 
 
</ul> 
 

 
<!-- Tab panes --> 
 
<div class="tab-content"> 
 
    <div class="tab-pane active" id="home" role="tabpanel">...</div> 
 
    <div class="tab-pane" id="profile" role="tabpanel">...</div> 
 
    <div class="tab-pane" id="messages" role="tabpanel">...</div> 
 
    <div class="tab-pane" id="settings" role="tabpanel">...</div> 
 
</div> 
 

 
</div>

+0

感謝。我在bootstrap網站上使用了該版本。奇怪這發生。 – Guerrilla

+1

它仍然在阿爾法,所以肯定會出現一些問題 – APAD1

+1

是的,我報告了他們的github頁面。我將從現在開始使用這個版本。 – Guerrilla