为什么这个段落元素溢出了它下面的div?为什么那个div留在原地?

时间:2013-06-25 17:44:56

标签: css html overflow

http://cowperthwaite.dev.mybusinessadmin.com/location/51656/103_carman_avenue/

在该页面上,您可以看到下方的黄色背景框保持不变,并且该段落在其上方爆炸。我不能为我的生活弄清楚为什么会这样。黄色背景的框未设置为position:absolute;或任何其他内容。这些部分都不是......而且无论如何,段落仍然会溢出。

这是HTML:

<div class="descriptionMap">
    <div class="leftcolumn">
        <h1><?php echo $address; ?></h1>
        <p><?php echo nl2br($description) ?></p>
    </div>
    <div class="rightcolumn">
        <?php echo($googleMapEmbedCode); ?>
    </div>
</div>
<div class="pictureBoxContainer">
    <div class="pictureBox">
        <div class="pBoxLeftColumn">
            <?php
                echo "<div class='pBoxLargeImageContainer'>";
                echo "<img src='$pictureLinks[0]' id='largeImage' alt='Primary Image' class='pBoxLargeImage'>";
                echo "</div>";
            ?>
        </div>
        <div class="pBoxRightColumn">
            <?php
            foreach ($pictureLinks as $picture)
            {
                echo "<div class='pBoxSmallImageContainer'>";
                echo "<img src='$picture' alt='Thumbnail' class='pBoxSmallImage'>";
                echo "</div>";
            }
            ?>
        </div>
    </div>
</div>

这是CSS:

.leftcolumn {
    float:left;
    max-width: 50%;
    display:inline-block;
    overflow:scroll;
}

.rightcolumn {
    float:right;
    max-width: 50%;
    display:inline-block;
}

.pictureBoxContainer {
    padding: 12px;
    clear:left;
    clear:right;
    width: 100%;
    background-color: #F7D961;
    border-radius: 12px;
    max-height: 350px;
    min-height: 325px;
}

.pictureBox {
    background-color: #FFF;
    border-radius: 12px;
    width: 97%;
    overflow: auto;
    padding: 12px;
    max-height: 300px;
    min-height: 299px;
}

.pBoxLeftColumn {
    display: block;
    left: 25px;
    max-width: 49.99%;
    min-width: 49.99%;
    position: absolute;
    top: 25px;
}

.pBoxRightColumn {
    display: block;
    float: right;
    min-width: 49.99%;
    max-width: 49.99%;
    overflow: auto;
}

.pBoxSmallImageContainer {
    height: 103px;
    width: 145px;
    float: left;
    padding: 3px;
    margin: 3px;
    background-color: #F7D961;
    border-radius: 2px;
    position: relative;
}

.pBoxSmallImage {
    max-height: 95px;
    max-width: 138px;
    margin: auto;
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

.pBoxLargeImageContainer {
    width: 100%;
}

.pBoxLargeImage {
    border-radius: 6px;
    min-width: 450px;
    max-height: 300px;
}

有什么想法吗?我在这里缺少什么?

1 个答案:

答案 0 :(得分:1)

<div class="descriptionMap clearfix">

.clearfix类将清除descriptionMap容器​​中的浮动。