简体   繁体   English

Bootstrap 容器宽度而不是屏幕宽度

[英]Bootstrap Container Width Instead of Screen Width

I'm using Bootstrap 4, but I don't want to use screen width.我正在使用 Bootstrap 4,但我不想使用屏幕宽度。 I want layout over whatever width the container has.我想在容器的任何宽度上进行布局。

I couldn't find the details after searching.我搜索后找不到详细信息。

The following codes are placed according to the screen width.以下代码根据屏幕宽度放置。 However, I want it to be adjusted according to the current width of the container I specified.但是,我希望它根据我指定的容器的当前宽度进行调整。


<div class="row">

<div class="col-lg-4">

SIDEBAR

</div>

<div class="col-lg-8">

<div class="row"> /*The following boxes should be shaped according to the width of this container.*/
<div class="col-xl-4 col-lg-3">A</div>
<div class="col-xl-4 col-lg-3">B</div>
<div class="col-xl-4 col-lg-3">C</div>
<div class="col-xl-4 col-lg-3">D</div>
</div>

</div>

</div>

I'm not very sure what you need exactly, but it seems that you want a boxed layout instead a fluid one.我不太确定您到底需要什么,但您似乎想要盒装布局而不是流畅的布局。 If you use a .container class will apply the boxed effect you want.如果您使用.container class 将应用您想要的盒装效果。

<div class="container">
    <div class="row">
        <div class="col-lg-3 col-xl-4">Column</div>
        <div class="col-lg-3 col-xl-4">Column</div>
    </div>
</div>

Here the documentation: https://getbootstrap.com/docs/4.0/layout/overview/这里的文档: https://getbootstrap.com/docs/4.0/layout/overview/

If this is not what you need, please try to be more clear about your goal.如果这不是您需要的,请尝试更清楚地了解您的目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM