[英]Hide column on smaller screens only with Bootstrap 4
我正在嘗試創建一個網格來用 3 列(左、中、右)覆蓋全屏
這是我的 html 標記
<div class="container-fluid">
<div class="row">
<div class="col-lg-2 d-md-none bg-dark text-white">
<h1>LEFT</h1>
<p>This column should only show up on large views and should be 16.6% of the screen (2/12)</p>
</div>
<div class="col-lg-8 col-md-9 bg-danger text-white">
<h1>MIDDLE</h1>
<p>This column should always show up. it should cover 75% (9/12) of the screen on <= mid-size view. And 66.6% (8/12) on a large views</p>
</div>
<div class="col-lg-2 col-md-3 bg-warning">
<h1>RIGHT</h1>
<p>This column should always show up. It should cover 16.6% (2/12) of the width on large view and 25% 3/12 on <= mid-size view</p>
</div>
</div>
</div>
這是我的代碼https://www.codeply.com/go/LRlYKlav32
d-md-none
似乎無法正常工作。 我希望在視圖較小時隱藏該列,但在較大視圖上應該可見。
我該如何解決這個問題?
如Bootstrap v4中缺少 visible-** 和 hidden-** 中所述...
如果你想要 lg 和 up 上的 LEFT,那就是: d-none d-lg-block
。
如果你想在LG的只留下那將是d-none d-lg-block d-xl-none
<div class="container-fluid">
<div class="row">
<div class="col-lg-2 d-none d-lg-block bg-dark text-white">
<h1>LEFT</h1>
<p>This column should only show up on large views and should be 16.6% of the screen (2/12)</p>
</div>
<div class="col-lg-8 col-md-9 bg-danger text-white">
<h1>MIDDLE</h1>
<p>This column should always show up. it should cover 75% (9/12) of the screen on <= mid-size view. And 66.6% (8/12) on a large views</p>
</div>
<div class="col-lg-2 col-md-3 bg-warning">
<h1>RIGHT</h1>
<p>This column should always show up. It should cover 16.6% (2/12) of the width on large view and 25% 3/12 on <= mid-size view</p>
</div>
</div>
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.