css - 使用 Meteor 数据 Bootstrap 多列

标签 css twitter-bootstrap meteor handlebars.js

我有一个 meteor 集合,它将数据提供给 handlebars 模板,该模板使用 bootstrap 设置样式,如下所示:

<template name="myClasses">
    <div class='span12 margins-center'>
    {{#each classes}}
    {{>classInfo}}
    {{/each}}
</div>
</template>

<template name="classInfo">
    <div class='well well-small span4 class-grid-item'>
        <h3>Welcome to {{subject}}</h3>
        <h4>Grade {{grade}}, Period {{period}}</h4>
        <p>{{description}}</p>
        <button class='btn btn-primary start-lesson'>
            I'm ready! Let's get started!
        </button>
    </div>
</template>

我的 main.html 文件包含:

<head>
  <title>My Cool App</title>
</head>
<body>
  {{> header}}
  <div class="container-fluid fill-height no-padding">
    {{> meteorNotices}}
    <div id="main" class="row row-fluid center">
      {{renderPage}}
    </div>
  </div>
  {{> footer}}
</body>

这是我为这个 block 设置的样式:

.class-grid-item {
    position: relative;
    min-height: 190px !important;
    .start-lesson {
        position: absolute;
        bottom: 10px;
        right: 10px;
        left: 10px;
        margin: 0px;
    }
}

.class-grid-item h3 {
    line-height: 22px;
}

.class-grid-item h4 {
    // margin-top: -16px;
    border-top: 1px solid #ccc;
    font-weight: lighter;
}

.margins-center {
    margin-left: auto;
    margin-right: auto;
}

我试图让两列在页面中居中。我似乎无法让列成为一个很好的有序网格。

有人能帮忙吗?

提前致谢!

最佳答案

.margins-center .span4:nth-child(3n + 4) {
    margin-left: 0px;
}

是允许网格布局的答案。

关于css - 使用 Meteor 数据 Bootstrap 多列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17957612/

相关文章:

html - 将 bootstrap CSS 类属性添加到文本框 ASP.Net MVC

html - Bootstrap 多个 float div 垂直居中

html - 位置固定不保持固定

html - svg+xml base64 url​​ 编码的 firefox 内容 : url(); 问题

jquery - Bootstrap CSS 过渡不起作用

javascript - 为什么以及如何为ckeditor解决 'Uncaught TypeError: Cannot read property ' setData' of undefined'

node.js - Meteor下划线无法调用未定义的方法 'exports'

android - Android 应用程序中未显示外部图像 - Meteor - Cordova

javascript - Meteor 1.0 - 使用变量作为键的 Mongo 查询,包括 $inc

css - border 导致 div 重叠超过 100% 1 或 2px