Bootstrap:固定流体布局中的沟槽宽度?

时间:2022-11-29 22:53:09

I want to have different layouts like [left|content|right] and [left|content] or [content|right] when using the fluid layout the gutter between the "cells" is also fluid and has a percentage value. But I would like to have a fixed width for the gutter like 10px or 20px between the left/right and content areas.

我希望在使用流体布局时,[left | content | right]和[left | content]或[content | right]具有不同的布局,“单元格”之间的沟槽也是流动的并且具有百分比值。但我希望在左/右和内容区域之间有一个固定的宽度,如10px或20px。

Any suggestion how to make this work? I've already tried it but ended always up with wildly shifting elements.

有什么建议如何使这项工作?我已经尝试过但总是以极其频繁的元素结束。

1 个解决方案

#1


20  

Answered a question like this before, what it basically came down too was creating a set of classes to offset the main container depending on how many sidebars you have, like so:

之前回答了这样的问题,它基本上也是根据你有多少副边创建一组类来抵消主容器,如下所示:

CSS

.fixed-fluid {
    margin-left: 240px;
}
.fluid-fixed {
    margin-right: 240px;
    margin-left:auto !important;
}
.fixed-fixed {
    margin: 0 240px;
}

Demo, edit here.

演示,在这里编辑。

#1


20  

Answered a question like this before, what it basically came down too was creating a set of classes to offset the main container depending on how many sidebars you have, like so:

之前回答了这样的问题,它基本上也是根据你有多少副边创建一组类来抵消主容器,如下所示:

CSS

.fixed-fluid {
    margin-left: 240px;
}
.fluid-fixed {
    margin-right: 240px;
    margin-left:auto !important;
}
.fixed-fixed {
    margin: 0 240px;
}

Demo, edit here.

演示,在这里编辑。