2012-05-25 34 views
1

CSS的所有瀏覽器:覆蓋CSS的box-shadow與標準的邊框屬性IE

.bordering { 
    -webkit-border-radius: 5px; 
    -moz-border-radius: 5px; 
    border-radius: 5px; 
    -webkit-box-shadow: #A3815B 0px 1px 3px; 
    -moz-box-shadow: #A3815B 0px 1px 3px; 
    box-shadow: #A3815B 0px 1px 3px; 
} 

CSS的IE:

.bordering { 
    border: 1px solid #A3815B; 
} 

當所有的瀏覽器CSS刪除.bordering類,在IE的邊界工作正常。

該怎麼辦,box-shadowFF,Opera和其他工作和通用border工作在IE一次。

嘗試:

.bordering { 
    -webkit-border-radius: none; 
    -moz-border-radius: none; 
    border-radius: none; 
    -webkit-box-shadow: none; 
    -moz-box-shadow: none; 
    box-shadow: none; 
} 

沒有幫助。

回答

2

創建一個獨立的CSS的IE瀏覽器像ie.css並將其與此鏈接到你的HTML頁面:

<![if IE]> 
<link rel="stylesheet" href="css/ie.css" type="text/css" media="screen" /> 
<![endif]> 

你的CSS將如果檢測到IE只包括在內。

之後,把你的.bordering CSS在你style.css(所有瀏覽器),只有在ie.cssborder: xxx

它應該工作。我做了很多次。

+0

我有單獨的IE瀏覽器文件,我在我的帖子中提到 – sergionni

+0

因此,使用它,因爲我解釋。 –

2

使用您的HTML條件註釋標籤樣把一個ie類此

<!--[if IE]><html class="ie"><![endif]--> 
<!--[if !IE]><!--><html><!--<![endif]--> 

(你可能需要閱讀http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/

然後設置樣式爲IE這樣的:

.ie .bordering { 
    /* your styles for IE */ 
} 

但是,我不明白你爲什麼想要抑制IE的box-shadow和border-radius。 IE9支持他們,他們只是降級到IE8和更老的陰影和矩形。


careful with using box-shadow on elements with large dimensionsborder-radius也一樣。

+0

我有單獨的IE文件,我在我的帖子中提到 – sergionni