蓝图问题

发布于 2024-09-06 11:19:04 字数 1413 浏览 3 评论 0原文

我有以下布局。第一行打印得很好,但第二行的开头从第二行的第二个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不醒的梦 2024-09-13 11:19:04

除非您使用压缩器更改默认列数,否则 Blueprint 默认使用 24 列。另外,您应该在某处定义一个容器:

<div class="container">
    <div class="span-24 last">
        Header Row
    </div>
    <div class="span-4">
        Blank buffer div (to keep 24 cols)
    </div>
    <div class="span-4">
        Content 1
    </div>
    <div class="span-4">
        Content 2
    </div>
    <div class="span-4">
        Content 3
    </div>
    <div class="span-4">
        Content 4
    </div>
    <div class="span-4 last">
        Another blank buffer
    </div>
</div>

基本上,您还应该确保所有列始终添加到 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:

<div class="container">
    <div class="span-24 last">
        Header Row
    </div>
    <div class="span-4">
        Blank buffer div (to keep 24 cols)
    </div>
    <div class="span-4">
        Content 1
    </div>
    <div class="span-4">
        Content 2
    </div>
    <div class="span-4">
        Content 3
    </div>
    <div class="span-4">
        Content 4
    </div>
    <div class="span-4 last">
        Another blank buffer
    </div>
</div>

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 a span-17 div with 4 span-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 use span-6 for each, which divides 4 blocks evenly into 24.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文