IE10中的跨浏览器css渐变,IE11

时间:2014-07-31 11:21:43

标签: css gradient internet-explorer-11

我在所有浏览器中为暗按钮做了渐变,看起来不错,除了IE10,IE11版本。顶部和底部有浅色条纹。 我通过colorzilla渐变编辑器生成渐变。

link to buttons

enter image description here

HTML

<div class="dark-button">div button</div>

CSS

.dark-button {
background: #0874b6; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzM0ODliZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMwMTZjYWQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #0874b6 0%, #016cad 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0874b6), color-stop(100%, #016cad)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0874b6 0%, #016cad 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0874b6 0%, #016cad 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0874b6 0%, #016cad 100%); /* IE10+ */
background: linear-gradient(to bottom, #0874b6 0%, #016cad 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0874b6', endColorstr='#016cad', GradientType=0); /* IE6-8 */
border: 1px solid #016cad;
border-radius: 3px;
color: #f1f1f1;
cursor: default;
display: inline-block;
margin: 5px;
padding: 6px 9px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);

}

我该如何解决?

2 个答案:

答案 0 :(得分:7)

我用这些他们做我想要的白色到从上到下的浅红色。 经测试: Windows 8.1中的FireFox 33.0.3 Windows 8.1中的IE 11.0.13 Windows 8.1中的Opera 25 Windows 8.1中的Chrome 38 OS X 10.10(Yosemite)中的Safari 8.0 OS X 10.10(Yosemite)中的Firefox 26.0

background: #ffffff; 
background: -webkit-linear-gradient(bottom, #d85570, white); /* For Safari 5.1 to 6.0 */
background: -moz-linear-gradient(top, white, #d85570); /* For Firefox 3.6 to 15 */
background: -o-linear-gradient(white, #d85570); /* For Opera 11.1 to 12.0 */ 
background: linear-gradient(top,#d85570, white); /* Standard syntax */
background: linear-gradient(to bottom, #white, #d85570); /* IE ? */
background: -ms-linear-gradient(top, #ffffff, #d85570); /* IE 11 */

答案 1 :(得分:1)

尝试使用http://css3pie.com/

css中的示例:

  background: -webkit-linear-gradient(#ffffff 0%, #000099 30%);
  background: -moz-linear-gradient(#ffffff 0%, #000099 30%);
  background: -o-linear-gradient(#ffffff 0%, #000099 30%);
  background: linear-gradient(#ffffff 0%, #000099 30%);
  -pie-background: linear-gradient(#ffffff 0%, #000099 30%);
  behavior: url("/Scripts/PIE.htc");
  background: -webkit-gradient(linear, 0 6px, 0 bottom, from(#ffffff), to(#000099));
  background: -ms-linear-gradient(top center, #ffffff 0%, #000099 30%);