简体   繁体   English

渐变和圆角CSS的IE9显示问题

[英]IE9 display issue for gradient and rounded corners CSS

I made a CSS class that applies a gradient and rounded corners to a span element to act as a button. 我制作了一个CSS类,该类将渐变和圆角应用于span元素以充当按钮。 It seems to work in most browsers that I've tested, but IE9 is giving me some issues. 在我测试过的大多数浏览器中,它似乎都可以工作,但是IE9给了我一些问题。 As the class is now the rounded corners aren't working correctly. 由于该类现在是圆角的,因此无法正常工作。 However if you look very close it seems like there are rounded corners underneath a layer that is not rounded (I think that's the best way to explain how it looks, forgive me if that doesn't make sense) 但是,如果您看起来非常接近,则似乎在未倒圆的图层下面有圆角(我认为这是解释其外观的最佳方法,请原谅我,如果这没有意义)

Anyway, by trial and error I messed with the class until I found that removing the 'display:inline-block;' 无论如何,由于反复试验,我弄乱了该类,直到发现删除了“ display:inline-block;”。 property allows for the rounded corners to be displayed correctly, but as a result the gradient no longer works. 属性允许正确显示圆角,但结果是渐变不再起作用。 Any ideas? 有任何想法吗?

http://jsfiddle.net/jessikwa/wcgzkkgr/ http://jsfiddle.net/jessikwa/wcgzkkgr/

The HTML: HTML:

<span class="action_button">Button</span>

The CSS: CSS:

.action_button
{
color: #FFFFFF;
font-size: 12px;
font-family: arial;
cursor: pointer;
text-decoration: none;
padding: 3px 5px;
display: inline-block;
text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
border: 1px solid #f7a03b;
webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: #8b8b8b 0px 1px 4px;
-moz-box-shadow: #8b8b8b 0px 1px 4px;
box-shadow: #8b8b8b 0px 1px 4px;
background-color: #efbb7f;
background-image: -webkit-gradient(linear, left top, left bottom, from(#efbb7f), to(#f88600));
background-image: -webkit-linear-gradient(top, #efbb7f, #f88600);
background-image: -moz-linear-gradient(top, #efbb7f, #f88600);
background-image: -ms-linear-gradient(top, #efbb7f, #f88600);
background-image: -o-linear-gradient(top, #efbb7f, #f88600);
background-image: linear-gradient(to bottom, #efbb7f, #f88600);
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#efbb7f, endColorstr=#f88600);
}

Update: Further reading of other posts in StackOverflow gets me a bit closer, but still not quite right. 更新:进一步阅读StackOverflow中的其他帖子可以使我更加接近,但仍然不太正确。

IE9 border-radius and background gradient bleeding IE9边界半径和背景渐变出血

This post's answer suggestions using an image, which I would prefer to avoid. 这篇文章的答案建议使用图片,我希望避免使用图片。 Another proposed answer of the thread puts a wrapper around the button with "overflow:hidden;", but this doesn't seem to be quite right, either. 线程的另一个建议答案是在按钮周围加上“ overflow:hidden;”包装,但这似乎也不是很正确。

http://jsfiddle.net/uu19uqg4/ http://jsfiddle.net/uu19uqg4/

you have forgot the "-" near webkit-border-radius 您忘记了webkit-border-radius附近的“-”

try this : 尝试这个 :

-webkit-border-radius: 3px;

this link can be usefull 链接可能有用

Add the following in the head of the page. 在页面顶部添加以下内容。

<meta http-equiv="X-UA-Compatible" content="IE=7,IE=8,IE=9" />

This will disable the compatibility mode in IE9. 这将禁用IE9中的兼容模式。 If it's due to compatibility issue then it will be solved. 如果是由于兼容性问题,那么它将得到解决。

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

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