sco*_*ott 3 css fallback gradient css3
我使用CSS3制作了一个圆圈,麻烦在旧浏览器(即7等)中,圆圈显示为正方形.
我知道我可以使用背景图像作为备份,但这不会破坏使用代码的意义吗?
如果我要将背景图像放入,那么它会在CSS中出现?
.ButtonB:hover, .ButtonB.hover {
background: -moz-linear-gradient(
center top,
rgba(255, 255, 255, .2) 0%,
rgba(255, 255, 255, .1) 100%
);/* FF3.6 */
background: -webkit-gradient(
linear,
center bottom,
center top,
from(rgba(255, 255, 255, .1)),
to(rgba(255, 255, 255, .2))
);/* Saf4+, Chrome */
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#33FFFFFF', EndColorStr='#19FFFFFF'); /* IE6,IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#33FFFFFF', EndColorStr='#19FFFFFF')"; /* IE8 */
}
Run Code Online (Sandbox Code Playgroud)
使用以下内容将为各种浏览器提供更好的支持,并且在不支持渐变时将回退为纯色,您可以将此纯色替换为图像.
background: #0A284B; /* for images use #0A284B url(image.jpg)*/
background: -webkit-gradient(linear, left top, left bottom, from(#0A284B), to(#135887));
background: -webkit-linear-gradient(#0A284B, #135887);
background: -moz-linear-gradient(top, #0A284B, #135887);
background: -ms-linear-gradient(#0A284B, #135887);
background: -o-linear-gradient(#0A284B, #135887);
background: linear-gradient(#0A284B, #135887);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0A284B', endColorstr='#135887');
zoom: 1;
Run Code Online (Sandbox Code Playgroud)
您需要指定一个height或zoom: 1要应用于hasLayout元素,以便在IE中工作.