html - CSS 两列布局

标签 html css

http://codepen.io/anon/pen/LFvlp

HTML

   <div class="entry-content">
  I’m not the only one in the family having a weakness for interiors. I think I received the microbe from my parents. Although our style is different on the first sight, there are still a lot of things we have in common. We both love contemporary design in combination with vintage. Also I have the love for design classics in my veins because of them.

The biggest difference is that the living room is a dark and cozy cave. But the design classics give the space that extra touch. Every time when I look at those, I discover a new detail. That makes this living room a real inspiration for me.


  <div class="post-tags">
    Chair: Hans J. Wegner, coffee table: Eames 
  </div>

</div>

CSS

 .entry-content {
         -webkit-column-count: 2; /* Chrome, Safari, Opera */
         -moz-column-count: 2; /* Firefox */
         column-count: 2;

         -webkit-column-gap: 30px; /* Chrome, Safari, Opera */
         -moz-column-gap: 30px; /* Firefox */
         column-gap: 30px;
     }

.post-tags {
  margin-top: 15px;
}

正如您在代码笔中看到的那样,我有两个 css 列。现在我希望“post-tags”div 始终与第一个 alinea 的最后一行处于同一高度。这可能吗?

最佳答案

.post-tags 之后插入另一个元素:这会强制渲染器采用 margin-top在计算列时考虑在内。

HTML:<div class="colfix">0</div> (不能为空)

CSS:.colfix{ visibility: hidden; }

演示:http://codepen.io/anon/pen/Dmwjc

关于html - CSS 两列布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26698088/

相关文章:

javascript - react : Toggle only one class without affecting the existing class

html - 如何关闭 PrismJS CSS 主题中的文本阴影?

javascript - 网站图书阅读器

css - 如何使用位置 :absolute inside the parent div? 放置此子 div

javascript - ng-repeat 中的 Angular js 条件类

javascript - 当没有数据时 document.write 停止工作

javascript - 你能传递一个 Angular 表达式作为实际的 ng-click 函数吗

html - 导航栏折叠后下拉列表项具有透明背景

html - 如何使用 CSS3 使用放大功能

php - CSS Sprites - 如何隐藏图像的平衡部分