蓝图问题
我有以下布局。第一行打印得很好,但第二行的开头从第二行的第二个 div 应该在的地方开始。如果我将第一行最后一个 div 的跨度设置为 3,则第二行打印正常。
父 div 是 670 像素,每个子 div 是 160(包括 10px 右边距)所有 4 个应该适合排成一行,但它们不是,这里出了什么问题?
我基本上想要一个 17 个跨度的父 div,其中有 4 行子 div,每个子 div 的跨度为 4。
<div id="parent" class="span-17 last>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4 last">
<span>content</content>
<span> image </content>
</div>
<!--row 2 starts -->
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4 last">
<span>content</content>
<span> image </content>
</div>
</div>
I have the following layout. the first row prints just fine, but the beginning of the 2nd row starts where the 2nd div on the 2nd row should be. If I set the span of the last div in the 1st row to 3, the 2nd prints fine.
the parent div is 670 pixels and each child is 160 (including 10px right margin) All 4 should fit in a row, but they are not, whats wrong here?
I bassically want a parent div of 17 spans with rows of 4 child divs each with span of 4.
<div id="parent" class="span-17 last>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4 last">
<span>content</content>
<span> image </content>
</div>
<!--row 2 starts -->
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4">
<span>content</content>
<span> image </content>
</div>
<div id="child" class="span-4 last">
<span>content</content>
<span> image </content>
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非您使用压缩器更改默认列数,否则 Blueprint 默认使用 24 列。另外,您应该在某处定义一个容器:
基本上,您还应该确保所有列始终添加到 24。
last
声明不会填充任何缺失的列。您提到了一个带有 4 个span-4
子级的span-17
div,这并不能相加。您缺少其中的一列,这可能会产生未定义的结果,或者至少看起来很糟糕。如果您不需要缓冲区
,只需对每个缓冲区使用
span-6
,它将 4 个块均匀地分为 24 个。Unless you've used a compressor to change the default number of columns, Blueprint uses 24 columns by default. Plus, you should be defining a container somewhere:
Basically, you should also ensure all columns add to 24 at all times. the
last
declaration does not fill in any missing columns. You mention aspan-17
div with 4span-4
children, which doesn't add up. You're missing a column in there, which can produce undefined results or at the least just look bad.If you don't want the buffer
<div>
s, just usespan-6
for each, which divides 4 blocks evenly into 24.