2013-05-10 128 views
0

我有一个带边框半径,背景渐变和工作在FireFox中的背景图像,但不是在IE8或IE10中。渐变和背景图像在IE8中工作,但是当我应用边框半径时,边框消失。边框半径,背景图像,背景渐变和IE8,IE10

.add-to-carttest { 
border: 1px solid #004f9e; 
padding: 5px 5px 5px 50px; 
width:100px; 
height: 40px; 
font-weight:bold; 
background: url(https://www.storesmart.com/mm5/graphics/00000001/add-to-cart-plus.png) no-repeat, -webkit-gradient(linear, 0 0, 0 bottom, from(#e1f0ff), to(#73b9ff)); 
background: url(https://www.storesmart.com/mm5/graphics/00000001/add-to-cart-plus.png) no-repeat, -webkit-linear-gradient(#e1f0ff, #73b9ff); 
background: url(https://www.storesmart.com/mm5/graphics/00000001/add-to-cart-plus.png) no-repeat, -ms-linear-gradient(#e1f0ff, #73b9ff); 
background: url(https://www.storesmart.com/mm5/graphics/00000001/add-to-cart-plus.png) no-repeat, -o-linear-gradient(#e1f0ff, #73b9ff); 
background: url(https://www.storesmart.com/mm5/graphics/00000001/add-to-cart-plus.png) no-repeat, linear-gradient(#e1f0ff, #73b9ff); 
background: url(https://www.storesmart.com/mm5/graphics/00000001/add-to-cart-plus.png) no-repeat, linear-gradient(#e1f0ff, #73b9ff); 
-webkit-border-radius: 4px; 
-moz-border-radius: 4px; 
border-radius: 4px; 
behavior: url(../../Graphics/PIE/PIE.htc); 
position:relative; 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#e1f0ff", endColorstr="#73b9ff",GradientType=0), progid:DXImageTransform.Microsoft.AlphaImageLoader(src="https://www.storesmart.com/mm5/graphics/00000001/add-to-cart-plus.png");} 
+0

此外,我怎么背景图像定位融入这个?我在所有这些行中插入了“no-repeat”和“-webkit etc”之间,它在FF和IE10中工作,但在IE8中,图像没有定位。 – 2013-05-10 18:11:42

回答

0

边界半径不提供IE8

http://www.quirksmode.org/css/backgrounds-borders/

哎呀 - 只注意到你的行为入门...可能要仔细检查你的路径

确定这里就是我“已经想出:

CSS:

.common 
{ 
    width: 100px; 
    height: 40px; 
    border: 1px solid #004f9e; 
    padding: 5px 5px 5px 50px; 
    margin: 0px; 
    font-weight: bold; 
    -webkit-border-radius: 4px; 
    -moz-border-radius: 4px; 
    border-radius: 4px; 
    !behavior: url(../../Graphics/PIE/PIE.htc); 
    position: relative; 
    border-collapse:collapse; 
} 

.add-to-carttest 
{ 
    background-image: url('https://www.storesmart.com/mm5/graphics/00000001/add-to-cart-plus.png'); 
    background-position:20px 20px; 
    background-repeat:no-repeat; 
    background-attachment:fixed; 
    top:-6px; 
    left:-51px; 
} 

.gradient 
{ 
    background: -moz-linear-gradient(#e1f0ff, #73b9ff); 
    background: -webkit-gradient(linear, 0 0, 0 bottom, from(#e1f0ff), to(#73b9ff)); 
    background: -webkit-linear-gradient(#e1f0ff, #73b9ff); 
    background: -ms-linear-gradient(#e1f0ff, #73b9ff); 
    background: -o-linear-gradient(#e1f0ff, #73b9ff); 
    background: linear-gradient(#e1f0ff, #73b9ff); 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e1f0ff', endColorstr='#73b9ff',GradientType=0); 
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#e1f0ff', endColorstr='#73b9ff',GradientType=0)"; 
} 

HTML:

<div class="common gradient"> 
    <div class="common add-to-carttest"></div> 
</div> 

似乎在IE8覆盖并隐藏梯度过滤器或重新定位该背景图像,因为它似乎本身呈现为图像的梯度。所以我拆开了CSS并且嵌套了divs。然后重新定位内部div以覆盖外部。这似乎工作,不优雅,但兼容。

此外,通过“左下角的”语法定位似乎只在新的浏览器来工作,所以我通过像素位置定位的背景图像

希望这有助于

+0

如果我拿出所有的“背景:网址”的东西,半径的作品。不知道我做错了什么。 – 2013-05-10 18:04:47

+0

为什么它的价值,这可能不是你,但IE8 :) - 仍试图找到解决方案tho – fnostro 2013-05-10 18:32:04

+0

感谢您的帮助。我应该从一开始就这样说,但我试图设计一个按钮。我不认为我可以把一个div放在一个按钮(输入)中。但你已经回答了我的问题:我正在尝试一些对IE来说过于宏大的事情。我应该只是将我的小图像和渐变整合到一个大背景图像中,或者将整个按钮变成图像。谢谢! – 2013-05-13 12:39:34