php - Laravel + Bootstrap - 让侧边栏与内容并排

标签 php html css twitter-bootstrap laravel

我正在使用 Laravel + bootstrap 和 columns/rows 。

但是当我使用较小的屏幕时。侧边栏位于顶部,内容位于下方。

我希望他们都留在自己的位置上,而不是变小。

这就是我希望它在台式机和手机/平板电脑上的样子

i1

这是它在手机上的显示方式:

i2

有没有什么方法可以并排修复它们,同时让它们像 laravel 和 bootstraps 预期的那样响应。

这是基本布局。

<div id="container-fluid">

                <div class="container">

                    <div class="col-sm-12">

                        <div class="col-sm-3">

                            @yield('sidebar')

                        </div>

                        <div class="col-sm-9">

                            @yield('content')

                        </div>

                    </div>

                </div>

            </div>

最佳答案

您必须将列从 sm(小型设备,例如平板电脑)更改为 xs(超小型设备,例如手机)。

<div id="container-fluid">
    <div class="container">
        <div class="row">
            <div class="col-xs-3">
                @yield('sidebar')
            </div>
            <div class="col-xs-9">
                @yield('content')
            </div>
        </div>
    </div>
</div>

来自 http://getbootstrap.com/css/#grid :

Grid classes apply to devices with screen widths greater than or equal to the breakpoint sizes, and override grid classes targeted at smaller devices. Therefore, e.g. applying any .col-md-* class to an element will not only affect its styling on medium devices but also on large devices if a .col-lg-* class is not present.

关于php - Laravel + Bootstrap - 让侧边栏与内容并排,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30975844/

相关文章:

html - 如何添加图标来选择框选项?

php - 明天前一分钟的 cron 作业

javascript - rails 5 : hide navigation drop-down on click

html - CSS 下拉菜单 z-index

html - Div 元素未定位为粘性

html - 选择和输入字段,相同的格式,不同的大小

php - 为什么这个 Zend 框架会占用我的 CPU 并加载页面如此之慢

php - Sql:跨多个表的唯一字段约束(slug)(doctrine/symfony)

php - Codeigniter 表单验证回调不起作用

html - CSS 显示内联 block 顶部对齐