html - 如何创建两列布局

标签 html css

我想知道是否可以通过以下方式设置两列布局:

我有

<div>
   <div>title </div>
   <div>content </div>
   <div>name </div>
   <div>data </div>
</div>

<div>
   <div>title </div>
   <div>content </div>
   <div>name </div>
   <div>data </div>
</div>

<div>
   <div>title </div>
   <div>content </div>
   <div>name </div>
   <div>data </div>
</div>

<div>
   <div>title </div>
   <div>content </div>
   <div>name </div>
   <div>data </div>
</div>

<div>
   <div>title </div>
   <div>content </div>
   <div>name </div>
   <div>data </div>
</div>


<div>
   <div>title </div>
   <div>content </div>
   <div>name </div>
   <div>data </div>
</div>


<div>
   <div>title </div>
   <div>content </div>
   <div>name </div>
   <div>data </div>
</div>



<div>
   <div>title </div>
   <div>content </div>
   <div>name </div>
   <div>data </div>
</div>



more....

我想要以下内容:

title       title
content     content
name        name
data        data

title       title
content     content
name        name
data        data

title       title
content     content
name        name
data        data

title       title
content     content
name        name
data        data

title       title
content     content
name        name
data        data

more ....

我不确定如何在 CSS 中执行此操作。有任何想法吗?非常感谢!

最佳答案

http://jsfiddle.net/fZse3/

<style>
#col1, #col2 {
    float:left;
    width: 50%;
}
</style>


  <div id="col1">
     <div>
        <div>title </div>
        <div>content </div>
        <div>name </div>
        <div>data </div>
     </div>

     <div>
        <div>title </div>
        <div>content </div>
        <div>name </div>
        <div>data </div>
     </div>
  </div>

  <div id="col2">
     <div>
        <div>title </div>
        <div>content </div>
        <div>name </div>
        <div>data </div>
     </div>

     <div>
        <div>title </div>
        <div>content </div>
        <div>name </div>
        <div>data </div>
     </div>
  </div>​

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

相关文章:

html - 如何在内容以不同分辨率调整大小时始终将页脚保持在底部

css - 变焦比。在 CSS3 中缩放

html - 使用 CSS 固定导航菜单高度

html - Google map 不会显示在 Phonegap iOS 应用程序中

javascript - 使用 JQuery 的意外 token 函数

javascript - Log4JavaScript服务器端接收

html - 自定义字体在 IE 中未以粗体或斜体呈现

javascript - HTML 链接到另一个页面不执行 javascript 或加载 CSS

html - 将父 div 居中,而 width 检索子 div 的宽度值

css - 放大折叠描述