Bootstrap grid layout when div is removed

江枫思渺然 提交于 2020-01-11 09:49:51

问题


So I am working with a dashboard look that has the possibility of having four 'squares' that can be switched on and role dependant on a users role.

The top row usually is left as it so has square around 30% and the other is around 70% width. This is fine.

However, on the bottom row of the dashboard, you can have two squares. When the two are switched on then my current grid setup works just fine but when a user has one square 'hidden' then the other square doesn't take up the whole row.

This is what I have so far. I can't post any of the elements that are in it but here's the outline.

<div class="row">
    <div class="col-lg-3 col-md-4 col-sm-5"></div>
    <div class="col-lg-9 col-md-8 col-sm-7"></div>

</div>
<div class="row">
    <div class="col-lg-6 col-md-8 col-sm-6">
    </div>
    <div class="col-lg-6 col-md-8 col-sm-6">
    </div>
</div>

Any solution to this or will I have to work on some sort of backend logic to find out if a user has all four columns shown or just three?


回答1:


You can use the auto-layout col columns which will fill the width...

<div class="row">
    <div class="col">
        ...
    </div>
    <div class="col">
        ...
    </div>
</div>

https://www.codeply.com/go/Y0WwVS7KMd



来源:https://stackoverflow.com/questions/52276191/bootstrap-grid-layout-when-div-is-removed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!