我的CSS代码在Chrome中运行正常,但不适用于Firefox。我认为这可能只是语法上的差异,但我无法弄清楚发生了什么。我的CSS代码中是否有错误?CSS适用于chrome,但不适用于firefox
#framed_source {
background-color: white;
display: block;
height: 97%;
width: 100%;
padding: 0px;
}
#grey_cover {
position: fixed;
height: 100%;
width: 100%;
padding: 0px;
margin: 0px;
top: 0px;
left: 0px;
background-color: #3F3F3F;
/* Transparency is applied through the transparent class */
}
#popup_window {
background: #D0E9F3;
visibility: visible;
border: 1px solid #666;
padding-top:20px;
padding-bottom:20px;
padding-right:20px;
padding-left:20px;
}
.with_frame {
position: absolute;
width: 600px;
}
#popup_window_content {
overflow: auto;
color: #1F313E;
font-family: Calibri;
max-height: 200px;
}
.transparent {
/* Required for IE 5, 6, 7 */
/* ...or something to trigger hasLayout, like zoom: 1; */
width: 100%;
/* Theoretically for IE 8 & 9 (more valid) */
/* ...but not required as filter works too */
/* should come BEFORE filter */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
/* This works in IE 8 & 9 too */
/* ... but also 5, 6, 7 */
filter: alpha(opacity=50);
/* Older than Firefox 0.9 */
-moz-opacity:0.5;
/* Safari 1.x (pre WebKit!) */
-khtml-opacity: 0.5;
/* Modern!
/* Firefox 0.9+, Safari 2?, Chrome any?
/* Opera 9+, IE 9+ */
opacity: 0.5;
}
基本上我有一个上的iframe中的顶部显示的弹出窗口。在Chrome中,它正确地执行此操作,在FF中它显示iframe下方的弹出窗口。有任何想法吗?我认为这与绝对/相对定位有关。
Picture of Firefox -- Incorrect CSS Picture of Chrome -- Correct CSS
我还创建了一个JSFiddle for this CSS with the corresponding HTML。我正试图让出现在框架下方的蓝色框出现在框架的中心。
难道这是一个zIndex问题?我没有看到你在任何时候指定它...... – FreeSnow
我更喜欢回答问题,我可以自己检查问题或者在哪里可以轻松地查看代码。我也不知道什么问题可以马上脱离蝙蝠。 – Joonas
注意事项:在某些地方你使用'background:'而在其他地方使用'background-color:'。我会坚持后者。 – Sparky