2012-05-15 27 views
3

我試圖在電子郵件中放置一個div,使其溢出後來放置的div,這些div是內聯塊(而不是將它們壓下),這是因爲所討論的div是display:inline。它似乎在Chrome中工作,但我無法在IE中正確渲染它,在那裏它被後來放置的內嵌塊div所限制。如何在沒有在IE中的電子郵件中推送其他內容的情況下讓div溢出?

這是我在說什麼(用DIV問題具有藍色背景)的例子:

<html> 
<head> 
<style type="text/css"> 
* { 
    margin: 0; 
    padding: 0; 
    border: 0; 
} 
div { 
    *display: inline!important; 
    _height: 1px; 
} 
</style> 
</head> 
<body style="width: 300px; height: 300px;"> 
    <div style="margin: 0; padding: 0; font-size: 1px; display: block!important; width: 300px; height: 300px; background-color: green;"> 
    <div style="margin: 0; padding: 0; font-size: 1px; display: inline-block; width: 300px; height: 10px; background-color: gray;"></div> 
    <div style="margin: 0; padding: 0; font-size: 1px; display: inline-block; width: 10px; height: 280px; background-color: gray;"></div> 
    <div style="margin: 0; padding: 0; display: inline-block; width: 280px; height: 280px; background-color: red; line-height: 23px; font-family: Helvetica, Arial, FreeSans, san0serif; color: #333;"> 
     <div style="margin: 0; padding: 0; margin-top: 0; width: 150px; height: 320px; background-color: blue; display: block;"></div> 
    </div> 
    <div style="margin: 0; padding: 0; display: inline-block; width: 10px; height: 280px; background-color: gray;"></div> 
    <div style="margin: 0; padding: 0; display: inline-block; width: 300px; height: 10px; background-color: gray;"></div> 
    </div> 
</body> 
</html> 

這是如何呈現在Chrome(和我將如何指望它渲染) : Correct

這是如何呈現在IE(8):

Incorrect

我如何讓IE瀏覽器像Chrome一樣渲染這個div?

+0

溢出:可見可能會伎倆。 – srijan

+0

這是默認設置,即使我嘗試覆蓋它也沒有什麼區別 –

回答

0

大多數電子郵件客戶端不會一直聽取css的100%。對於Web客戶端電子郵件視圖,這在某種程度上也適用。你需要將2個div從容器對象中分離出來。 IE:兩個單獨的包含所以當左邊的溢出之一 - 右邊的div沒有。

編輯:這裏有一個良好的兼容性地圖:http://www.campaignmonitor.com/css/

0

你試過浮動紅色和藍色的div?這將它們從文檔流中移除,並且如果相對定位且z索引正確,應該按照您的要求顯示。

相關問題