CSS / PHP:如何解决这个div浮点问题/数组中的奇偶循环 [英] css/php: how to solve this div float problem / odd even loop in array

查看:66
本文介绍了CSS / PHP:如何解决这个div浮点问题/数组中的奇偶循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码在这篇文章的结尾。

My code is at the end of this post.

我到底是如何在 box 1或内容旁边添加 box 3的?

How on earth do i get "box 3" to aligh next to "box 1" OR to the content inside "box 1" instead of aligning itself at the end of "box 2".

这里重要的是,所有四个方框必须使用相同的样式-(style 2)因为它正在被数组调用使用。

The important thing here is that all four boxes MUST use the same style - (style 2) as it's being used in an called by an array.

这里是现在的样子,我正试图实现的东西:

Here is what it is now and what i#m trying to make happen:

http://img524.imageshack.us/img524 /1408/lastexample.gif

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {border:1px solid #000000; width:620px; position:relative;
}
.style2 {border:1px solid #000000; width:300px; float:left;}
-->
</style>
</head>

<body>
<div class="style1">

    <div class="style2">box 1<br>
      <br>
      <br>
    </div>
    <div class="style2">box 2<br>
      <br>
      <br>
      <br>
  </div>

    <div class="style2">box 3<br>
      <br>
    </div>
    <div class="style2">box 4<br>
      <br>
      <br>
    </div>
</div>
</body>
</html>


推荐答案

不知道使用此方法的方法所有内部DIV使用单一类的纯CSS。您想要类似砌体的东西。

Don't know of a way to get this with pure CSS using a single class for all the interior DIVs. You want something like Masonry.


当CSS的另一面浮动时,请考虑砌石。当浮子将元素水平然后垂直放置时,石工将元素垂直然后水平放置。结果使高度不同的元素之间没有垂直间隙,就像砌墙的石匠在石头上一样。

-砌体主页

这篇关于CSS / PHP:如何解决这个div浮点问题/数组中的奇偶循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆