我有一个 div,在那个 div 的下面我显示一个带有 iframe 的 div,它动态地在同一页面中加载 html 页面..但是发生的是带有 iframe 的 div 覆盖上部作为 iframe containg html haev长高..所以任何人都可以告诉我如何将包含 iframe 的 div 放在上面的 div 标签下面,而不管 iframe 中加载了哪些内容。而且我想让它在 chrome 和 mozila 中看起来一样。 .
以下是我的结构...
<div class="row-fluid">
<div class="span3" id="media_select">
<label
style="float: left; padding-top: 5px; padding-bottom: 10px; padding-right: 10px; padding-left: 22px"> Media
</label><select style="width:125px" name="mediatype" id="mediatype"
data-placeholder="- Select Ad Type -" class="chzn-select"
tabindex="4">
<option value="0">Select All</option>
<%
List<mediatype> media_typelist = mediatypeLocalServiceUtil
.getAllMediaType();
for (mediatype media_typelistitem : media_typelist) {
%>
<option value=<%=media_typelistitem.getPrimaryKey()%>><%=media_typelistitem.getMedianame()%></option>
<%
}
%>
</select>
</div>
<div class="span3">
</div>
//这是我要固定在上层下方的div
<div class="bordercolor" id="mydiv" style="display: none; text-align: center">
<IFRAME SRC="" id="reportpreview" style="text-align: center;"
marginheight="0" frameborder="0" onLoad="sizeFrame();"></iframe>
</div>
iframe 的高度在以下脚本中动态分配:-
function sizeFrame() {
var F = document.getElementById('reportpreview');
if(F.contentDocument) {
F.height = F.contentDocument.documentElement.scrollHeight+30; //FF 3.0.11, Opera 9.63, and Chrome
} else {
F.height = F.contentWindow.document.body.scrollHeight+30; //IE6, IE7 and Chrome
}
}
///报告预览 id 的 css//一个 iframe
#reportpreview {
float:center;
margin-top:10%;
margin-bottom:10%;
zoom: 1.2;
-moz-transform: scale(1.2);
-moz-transform-origin: 2 0;
-webkit-transform: scale(1.2);
-webkit-transform-origin: 2 0;
width: 720px;
min-height: 37px;
}
最佳答案
#reportpreview {
clear:left;
float:center;
margin-top:10%;
margin-bottom:10%;
zoom: 1.2;
-moz-transform: scale(1.2);
-moz-transform-origin: 2 0;
-webkit-transform: scale(1.2);
-webkit-transform-origin: 2 0;
width: 720px;
min-height: 37px;
}
将 clear:left
添加到 iframe div
关于css - 如何固定 Div 位置总是低于其他上层 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14451894/