简体   繁体   English

“线性渐变”在IE9和Safari中不起作用

[英]“linear-gradient” not working in IE9 and Safari

I try to apply a style to a button but this style displays well on Mozilla and Chrome then it is not the case for Safari and IE9. 我尝试将一种样式应用于按钮,但是这种样式在Mozilla和Chrome上显示良好,那么Safari和IE9并非如此。

Here is the css class: 这是css类:

#bt_D{
width:130px;
height:30px;
box-shadow:1px 2px 4px rgba(0,0,0,0.60);
font-size:12px;
background-image:linear-gradient(60deg, rgb(231,110,49), rgb(231,171,49));
border:1px solid rgb(180,180,180);
border-radius:5px;
float:right;
text-align:center;
vertical-align:middle;
}

But when i inspect the button , i find in quoted of the property linear-gradient a yellow exclamation mark which indicates that this property is not recognized by the browser (safari or IE9) 但是,当我检查按钮时,我linear-gradient属性的引号中发现了一个黄色的感叹号,表示该属性无法被浏览器识别(Safari或IE9)

Any idea to solve this issue? 有解决这个问题的主意吗?

For Safari, you will have to put an additional, so-called "vendor-prefixed" version of the definition: 对于Safari,您必须添加定义的附加的,所谓的“供应商前缀”版本:

background-image: -webkit-linear-gradient(60deg, rgb(231,110,49), rgb(231,171,49));

For IE9 (which has no support for CSS gradients) you must use an image as a fallback, either png/gif/jpg, or better SVG. 对于IE9(不支持CSS渐变),您必须使用图片作为后备图片,无论是png / gif / jpg还是更好的SVG。

Here is one of many gradient generators that also creates the SVG you want: 这是许多渐变生成器之一,也可以创建所需的SVG:

http://www.colorzilla.com/gradient-editor/ http://www.colorzilla.com/gradient-editor/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM