html - 相同的 div 不堆叠而是重叠

标签 html css twitter-bootstrap

我有一个要保存一些内容的 div,我将在下面多次复制该 div。

当我多次重复 div 时,我看到内容相互重叠而不是堆叠。

检查时,我可以看到容器的高度没有设置。高度不会根据div中的内容设置吗?我当时有那种印象,但不确定我现在身在何处。

这是我的 fiddle 。 http://jsfiddle.net/5jq52/2/

<div class="row">
<div class="col-md-5">
<div class="Mycontainer">
    <div class="Item1">
        <img src="http://placehold.it/150x150" class="Pic">
    </div>
    <div class="Item2">
        <img src="http://placehold.it/150x150" class="Pic">
    </div>
</div>
<div class="Mycontainer">
    <div class="Item1">
        <img src="http://placehold.it/150x150" class="Pic">
    </div>
    <div class="Item2">
        <img src="http://placehold.it/150x150" class="Pic">
    </div>
</div>
</div>
</div>

非常感谢阅读和解决。 ;)

最佳答案

您实际上遇到了几个不同的问题。您的 div 彼此重叠而不堆叠的原因是因为您在应该使用 position: relative; 时指定了 position: absolute;

关于html - 相同的 div 不堆叠而是重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23901844/

相关文章:

javascript - 无需填写所有字段且无需按钮即可获取平均值

python - Perl 的 HTML::Form::ForceValue 在 Python 中等效

html - CSS:如何增加两个元素之间的距离?

javascript - 网页无法自动适应移动浏览器

css - Bootstrap 3 行背景颜色扩展窗口宽度的 100%

javascript - 避免在 bootstrap 3 表中换行

html - 在具有空格的对象的 django 模板中创建超链接

html - 将 CSS 获取到 "float: right"并垂直居中

javascript - 如何规范化 CSSStyleDeclaration 对象的单位?

html - 解析 HTML 文件以获取 CSS 文件的所有 ID 和类