我的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