我在使用 IE9 时遇到了一点问题,只是想不通,我在 CSS 中创建了一个带有线性渐变的按钮,它在 Chorme、Firefox 和 Safari 中完美显示,但在 IE9 中却没有
http://ubizzo.co.uk/img/ie9.png
http://ubizzo.co.uk/img/ch-fi-sa.png
第一个图片链接是 IE9,第二个图片链接是所有其他浏览器,我可以让它工作的唯一方法是如果我在 CSS 中添加 float:left 或 float:right ,如下所示,但这显然会搞砸布局,我已经尝试使用 float:none 但这也不起作用,我在一个空白的 html 文件中尝试了这个,只是为了排除任何冲突的 css 但仍然不起作用:-s
.purchase {
margin-top: 5px;
display: block;
width: auto;
}
.purchase a {
margin-top: 10px;
margin-bottom: 10px;
padding: 5px 10px;
cursor: pointer;
border: none;
color: #fff;
line-height: 1em;
width: auto;
**float: left;**
border-image: initial;
text-align: center;
border: solid 1px #189199;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
background: -moz-linear-gradient(top, #19d7e3, #12A4B3);
background: -webkit-gradient(linear, left top, left bottom, from(#19d7e3), to(#12A4B3));
background: -moz-linear-gradient(top, #19d7e3, #12A4B3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#19d7e3', endColorstr='#12A4B3');
}
.purchase a:hover {
background: -moz-linear-gradient(top, #12A4B3, #19d7e3);
background: -webkit-gradient(linear, left top, left bottom, from(#12A4B3), to(#19d7e3));
background: -moz-linear-gradient(top, #12A4B3, #19d7e3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#12A4B3', endColorstr='#19d7e3');
color: #ffffff;
}
感谢您的帮助,亚当。
http://jsfiddle.net/gdmP8/ - 请注意,该按钮仅在您添加 float:left/right 后才会显示