CSS Floated div在窗口大小调整上重叠。我怎么阻止这个?

时间:2014-04-11 20:43:26

标签: css html nested overlap

我刚刚在www.chartoonz.com上重新完成了我的网站

我创建了一个包装器div,我在其中放置了一个div,其中包含指向vimeo上我的视频的链接。我把这个div漂浮在旁边,在它旁边我已经浮动了一个div,上面有一些关于电影的文字并将它漂浮了。列看起来没问题,直到窗口调整大小。然后他们重叠得很厉害,我无法弄明白为什么。如果调整窗口大小,我希望右浮动列跳到左浮动列的下方。

相关的HTML如下所示:

<div id="CopyWrapper" >

        <div class = "copyFloatLeft">
        <p><strong>Use Video to Communicate.</strong></p>
        <p><iframe src="//player.vimeo.com/video/90334225" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></p>
        <br />
        </p>
        <br /><br />
    </div>
    <div class = "copyFloatRight">
            <strong>Corporate Communications</strong> 
            <p> Corporate communications can be greatly enhanced through a well presented video. Ideas and concepts are easier to understand when they can be seen clearly and their meaning is made plain. Here, I present some of the work I did over the last few months, helping the Merrill Lynch digital advertising division get their message out.</p>
    </div>

    <br /> 
</div>
<br class="clearFloat" />

管理CSS看起来像这样:

#CopyWrapper{
background: center;
text-align: left;
display: block;
float: left;
width: 65%;
padding-left: 200px;
position: relative;
margin: 0 auto;
clear: both;
overflow: hidden;
}


.copyFloatLeft{
background: center;
width: 45%;
margin:5px;
padding: 15px 15px 5px 15px;
position: relative;
clear: right;
float: left;
display: block;
}



.copyFloatRight{
background: center;
width: 45%;
margin:5px;
padding: 15px 15px 5px 15px;
position: relative;
clear: right;
float: right;
display: block;

}

任何帮助都将不胜感激。

阿哈拉比诺

1 个答案:

答案 0 :(得分:1)

.copyFloatLeft.copyFloatRight块应向左浮动

对于iframe,我会做类似的事情:

#CopyWrapper iframe {
    width: 100%;
}