带有 CSS 的 IE7 中的背景渐变 [英] background gradients in IE7 with CSS

查看:27
本文介绍了带有 CSS 的 IE7 中的背景渐变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的 CSS 来创建线性背景渐变.它似乎在 IE8/9、FF、Safari 和 chrome 中工作得很好,但在 IE7 中却不行.IE7 显示纯色(绿色)背景.这是我的代码

I am using the following bit of CSS to create a linear background gradient. It seems to work just fine in IE8/9, FF, Safari and chrome but not in IE7. IE7 shows a solid (green) background. Here is my code

.menu_body a {
  display:block;
  color:#006699;
  background: #008800;
  /* Mozilla: */
  background: -moz-linear-gradient(top, #0b71a4, #025f8e);
  /* Chrome, Safari:*/
  background: -webkit-gradient(linear,
            left top, left bottom, from(#0b71a4), to(#025f8e));
  /* MSIE */
  filter: progid:DXImageTransform.Microsoft.Gradient(
            StartColorStr='#0b71a4', EndColorStr='#025f8e', GradientType=0);
  padding: 1px 18px;
}   

推荐答案

在 IE<=7 中,除非元素具有 布局.

zoom: 1;

请注意,它可能会破坏其他东西,所以旧的 background-image 可能是安全可靠的解决方案.

Be aware that it can break other things, so old good background-image might be safe and reliable solution.

另外请注意,您的 CSS 缺少 Opera、IE10 的渐变属性和更新的 Webkit 语法.

Also please note that your CSS lacks gradient properties for Opera, IE10 and updated syntax for Webkit.

这篇关于带有 CSS 的 IE7 中的背景渐变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆