【问题标题】:changing spaces between rows in Skeleton Framework.在 Skeleton Framework 中更改行之间的空间。
【发布时间】:2016-04-27 01:08:44
【问题描述】:

现在我有两个使用“半列”类的 div。

正如您在此处看到的,左侧底部的卡片仍与右下方的卡片对齐。

我想要这样的 Pinterest 风格,但我不知道怎么做,因为它们在不同的行中。

这是我的 html 代码。

<div class="container">
<div class="row">
  <div id="cards" class="one-half column" style="margin-top: 25%">
    <img class="card-image" src="img/sample.png">
    <div class="title">
    <h4>Stealth Rats</h4>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus suscipit eu nibh vitae maximus.</p>
    </div>
  </div>
   <div id="cards" class="one-half column" style="margin-top: 25%">
    <img class="card-image" src="img/sample.png">
    <div class="title">
    <h4>Basic Page</h4>
    <p>This index.html page is a placeholder with the CSS, font and favicon. It's just waiting for you to add some content! If you need some help hit up the <a href="http://www.getskeleton.com">Skeleton documentation</a>.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus suscipit eu nibh vitae maximus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc a mollis arcu.</p>
    </div>
  </div>
</div>

<div class="row">
  <div id="cards" class="one-half column" style="margin-top: 5%">
  <img class="card-image" src="img/sample.png">
    <h4>Basic Page</h4>
    <p>This index.html page is a placeholder with the CSS, font and favicon. It's just waiting for you to add some content! If you need some help hit up the <a href="http://www.getskeleton.com">Skeleton documentation</a>.</p>
  </div>
   <div id="cards" class="one-half column" style="margin-top: 5%">
   <img class="card-image" src="img/sample.png">
    <h4>Basic Page</h4>
    <p>This index.html page is a placeholder with the CSS, font and favicon. It's just waiting for you to add some content! If you need some help hit up the <a href="http://www.getskeleton.com">Skeleton documentation</a>.</p>
  </div>

提前致谢!

【问题讨论】:

    标签: html css frameworks


    【解决方案1】:

    除非您使用列而不是行(这会破坏内容的重要性),否则您无法在纯 css 中执行此操作。

    你想要的是 Masonry 或其他 javascript 替代品。

    另外,你的 html 有错误,你不能多次使用同一个 id。将其更改为 class='cards' 如果您想使用砌体,则必须将每张卡片放在同一个 div 中,因此在这种情况下,放在同一行中。

    那你就可以调用它了

    $('.row').masonry({
      itemSelector: '.cards',
      columnWidth: 200 //this is an example.
    });
    

    由于砌体是响应式的,因此您可以忘记这部分的骨架。

    【讨论】:

    • 非常感谢您的帮助!那么我可以将 Masonry 与 Skeleton 一起使用吗?
    • 是的,但是您不会利用行和列类,因为它会覆盖它。只需制作一个div,然后将所有卡片放在那里。然后在我给你的例子中使用那个 div 类或 id 而不是 '.row' 调用 masonry
    猜你喜欢
    • 1970-01-01
    • 2016-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多