html - Bootstrap 上的自定义列大小(不影响响应式设计)

标签 html css twitter-bootstrap

我想在我的页面上创建一个非常小的带有 Bootstrap 的左侧菜单,如下所示:

<div class="row>
    <div class="col-md-1 col-sm-1 leftMenu"></div>
    <div class="col-md-7 col-sm-7 main"></div>
    <div class="col-md-4 col-sm-4 rightMenu"></div>
</div>

但是 col-md-1 对于我的菜单来说太大了。我想要一个等于 50px 的宽度;

我找不到一个解决方案来使菜单的尺寸小于最小列,同时不影响我页面的响应式设计

有人能回答我的问题吗?

最佳答案

如果您想继续使用 Bootstrap,您可以定义新的列宽,例如 0.5/12 和 7.5/12:

col-md-0-5 | col-md-7-5 | col-md-4
col-sm-0-5 | col-sm-7-5 | col-sm-4

如果您检查 bootstrap.css文件,您可以定义新的 col-md-0-5col-md-7-5 类,如下所示:

.col-md-0-5, .col-md-7-5 {
    position: relative;
    min-height: 1px;
    padding-right: 15px;
    padding-left: 15px;
}

@media (min-width: 992px) {
    .col-md-0-5, .col-md-7-5 {
        float: left;
    }
    .col-md-0-5 {
        width: 4.16666667%;
    }
    .col-md-7-5 {
        width: 62.5%;
    }
}

只需按照相同的逻辑定义新的 col-xs-0-5col-xs-7-5 类即可。

关于html - Bootstrap 上的自定义列大小(不影响响应式设计),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35335595/

相关文章:

html - 语义 UI 中心对齐登录框?

html - CSS 链接在 jsp 中不起作用

javascript - 从第一个按钮下拉后移动下一个按钮

css - Bootstrap 3 组合框在移动 View 中停止工作

python - 如何使用selenium选择单选按钮

html - bootstrap-horizo​​n 删除列之间的空间

html - 如何在 bootstrap 3 中将下拉菜单放入另一个下拉菜单?

html - 推特 Bootstrap : hiding a row-fluid container without the row's other containers to the right sliding left?

css - “example” 推特 Bootstrap 中的标题

javascript - 如果互联网可用,则导入 JavaScript 文件