【问题标题】:Zurb-Foundation block grid missing cellZurb-Foundation 块网格缺失单元格
【发布时间】:2014-11-17 23:40:42
【问题描述】:

我使用 Zurb Foundation 块网格布局并遇到一个问题。
我有这段代码与 Ember.JS

<div class="row">
    <ul class="small-block-grid-2 large-block-grid-5">
         {{render Ember.JS View}}
    </ul>
</div>

Ember 生成 7 个 &lt;li&gt; 元素,它们应该看起来像 http://jsfiddle.net/67obcg00/
但是,在页面上,整个网格向右移动。这样第一行的第一个单元格为空,第二个单元格包含 li#1 of 7.
最终,最后一行包含两个单元格而不是一个。

有什么建议吗?
谢谢。

【问题讨论】:

    标签: javascript css ember.js zurb-foundation


    【解决方案1】:

    这是使用 Ember 1.7 和 Zurb 4.1.6 的工作 jsbin

    还有一个使用 Ember 1.9 beta、Handlebars 2.0 和 Zurb 5.4.7 的版本 jsbin

    使用 css 选择器 [:nth-child][3] 和 pre ember.js 1.8 时遇到的问题是 ember 使用的元变形标记知道它负责更新 DOM 的哪些部分。 nth-child 选择器会将样式应用于脚本标签以及列表元素。

    <ul class="small-block-grid-2 large-block-grid-5">
        <script id="metamorph-10-start" type="text/x-placeholder"></script><script id="metamorph-2-start" type="text/x-placeholder"></script>
       <li><img src="http://placehold.it/395x590" data-bindattr-287="287"></li>
       <script id="metamorph-2-end" type="text/x-placeholder"></script><script id="metamorph-3-start" type="text/x-placeholder"></script>
    </ul>
    

    使用 css 选择器:nth-of-type 只会应用于指定类型的样式。

    干杯,希望对您有所帮助。

    【讨论】:

    • 我检查了我的 Ember 版本,它是 1.4.0。据我了解,我应该更新到 1.8.0 来解决这个问题,对吧?
    • 确保将 Ember 更新到 1.8 或编写自己的块网格。与第 n 个孩子。 .small-block-grid-2 &gt; li { width: 50%; list-style: none; } .small-block-grid-2 &gt; li:nth-child(1n) { clear: none; } .small-block-grid-2 &gt; li:nth-child(2n+1) { clear: both; }
    猜你喜欢
    • 1970-01-01
    • 2013-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-06
    • 1970-01-01
    • 2013-02-16
    • 1970-01-01
    相关资源
    最近更新 更多