CSS背景属性不能覆盖IE过滤器属性? [英] CSS background property can not override IE filter property?

查看:250
本文介绍了CSS背景属性不能覆盖IE过滤器属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标签,其背景是渐变的默认(IE)。

I have a label whose background is gradient by default(IE ).

     label{
      width:100px;
      height:100px;
      border:1px solid red;
      filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorStr="#ff3333",endColorStr="#663300");
     }
<label> Rama Rao </label>

我允许用户更改渐变或正常的背景颜色。我得到用户输入的值,并设置css:

I am allowing user to change that background color either gradient or normal. I am getting the value that user has entered,and setting css:

<label style="background:#val1"> Rama Rao </label>

  <label style="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorStr="#val1",endColorStr="#val2");"> Rama Rao </label>

如果用户再次设置渐变...但不是用户输入正常颜色...根据我的知识, inline-style 可以覆盖内部样式.....但它不工作在过滤器 case (我的意思是,过滤器不能被背景覆盖) ...如何克服这个问题?

注意我在这里提到了< label> ...但是它可能发生在任何标签....

It works if user again sets gradient ...but not if user enter normal color...But as per my knowledge,an inline-style can override internal style.....But its not working in filter case (I mean, a filter cannot be overridden by background)...How can I overcome this?
Note : For name shake,I mentioned <label> here...But it may happen for any tag....

推荐答案

您可以使用以下命令删除它:

You can remove it using this:

filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);

也可以检查这个小提琴我做了此处

Also you can check this fiddle I made here.

您用于渐变的代码仅适用于Internet Explorer。如果您需要与大多数浏览器兼容的代码,请在此处查看此工具。

And the code your are using for gradients is for Internet Explorer only. If you want code that is compatible for most browsers check this tool here.

这篇关于CSS背景属性不能覆盖IE过滤器属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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