为什么我的奇点网格中的浮点数不填充所有列? [英] Why don't my floats in my Singularity grid fill all the columns?
问题描述
这里是SassMeister。这是一个四列的子布局,其中包含浮动菜单项,我希望它们来填充列,但由于边距太大,因此它们会聚集在前三个中。
Here is the SassMeister. It's a four column sub-layout with floated menu items and i'd like them to fill the columns, but instead they cluster in the first three because the margins are too big.
http://sassmeister.com/gist/b45986bb5bcbc464b3aa
对为什么会发生这种情况有任何见解?
Any insights into why this might be happening?
推荐答案
哇,那是一些杂乱的Drupal标记!您应该清理它并发布减少问题的演示,而不是仅仅粘贴所有内容。
Wow, that's some messy Drupal markup! You should've cleaned it up and post a reduced demo of your problem rather than just copy-pasting all the mess.
float-span
mixin设置项目的右边距,除非您将第二个参数指定为'last'
或最后一列的编号。
The float-span
mixin sets a right margin for an item unless you specify the second argument to be either 'last'
or the number of the last column.
之所以失败,是因为您的网格中有4列和3个装订线,但是您告诉Singularity每行生成4个单列项目,每个项目有一个装订线,并且您最终得到4列和4个装订线。最后一个项目不适合并包装到下一行。
The reason why this fails is that you have 4 columns and 3 gutters in your grid, but you tell Singularity to produce per row 4 one-column items with a gutter each, and you end up with 4 columns and 4 gutters. The last item won't fit and is wrapped to the next row.
解决方案是应用'last'
移至第四个项目:
The solution is to apply 'last'
to every fourth item:
.menu-block-1 .leaf {
@include float-span(1);
&:nth-child(4n+4) {
@include float-span(1, 'last');
}
}
演示: http://sassmeister.com/gist/5723f9c604752802af05
这篇关于为什么我的奇点网格中的浮点数不填充所有列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!