为什么IE9中的border-radius不起作用,但在IE10或Chrome中?

时间:2013-06-13 06:41:54

标签: css html css3

我只有IE9有问题,原因是... border-radius只在一个div中工作但在其他div中工作得很好。

IE9 enter image description here

IE10,Chrome,FF enter image description here

HTML

<article id="main-login">
<div class="radius-10 shadow"></div>
<div id="area-login" class="radius-10 shadow">
    <h2>Iniciar sesión</h2>
    <p><input id="user-user" class="radius-10" type="text" placeholder="Usuario" required/></p>
    <p><input id="user-pass" class="radius-10" type="password" placeholder="Contraseña" required/></p>
    <p><input id="do-login" type="submit" value=""/></p>
    <small>Si aún no eres usuario</small>
    <medium>Registrate aquí</medium>
</div>
</article>

CSS

.radius-10 {
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
}

.shadow {
    -webkit-box-shadow: 0px 1px 12px rgba(50, 50, 50, 0.75);
    -moz-box-shadow:    0px 1px 12px rgba(50, 50, 50, 0.75);
    box-shadow:         0px 1px 12px rgba(50, 50, 50, 0.75);
}
#main-login {
    margin-top: 25px;
    width: 100%;
}
#main-login div {
    display: inline-block;
    height: 170px;
    vertical-align: top;
} 
#main-login > div:first-child {
    background: url(../media/images/medicos.jpg) no-repeat;
    background-attachment:fixed;
    margin-right: 20px;
    overflow: hidden;
    width: 73%;
}
#area-login {
    background: rgb(255,255,255); /* Old browsers */
    /* IE9 SVG, needs conditional override of 'filter' to 'none' */
    background:     url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSI4MiUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZTVlY2VmIiBzdG9wLW9wYWNpdHk9IjEiLz4KICA8L2xpbmVhckdyYWRpZW50PgogIDxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9InVybCgjZ3JhZC11Y2dnLWdlbmVyYXRlZCkiIC8+Cjwvc3ZnPg==);
    background: -moz-linear-gradient(top,  rgba(255,255,255,1) 82%, rgba(229,236,239,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(82%,rgba(255,255,255,1)), color-stop(100%,rgba(229,236,239,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(255,255,255,1) 82%,rgba(229,236,239,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(255,255,255,1) 82%,rgba(229,236,239,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(255,255,255,1) 82%,rgba(229,236,239,1) 100%); /* IE10+ */
    background: linear-gradient(to bottom,  rgba(255,255,255,1) 82%,rgba(229,236,239,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5ecef',GradientType=0 ); /* IE6-8 */
    width: 24%;
}

更新

感谢您的时间,但我解决了我的问题。

解决方案:在CSS中使用border-radius和过滤器存在问题,然后只需对此行进行注释:

 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5ecef',GradientType=0 ); /* IE6-8 */

工作正常!!

2 个答案:

答案 0 :(得分:0)

将.radius-10的内容更改为:

.radius-10 {
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
}

对于IE9,请在<head>标记内添加以下行。

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

最后,不要忘记添加:

<!DOCTYPE html>

更新

display中的#main-login div更改为block

答案 1 :(得分:0)

通过仅为IE9声明filter: none;来解决此问题。如果您使用conditional comments来帮助您获取特定类,则可以禁用此过滤器:

.ie9 .class-with-gradient {
    filter: none;
}

或者为这些元素添加另一个类(如果有多个)并为它们禁用它。 像这样:

.gradient {
    filter: none;
}

确保只有IE9才能获得此课程。否则 - IE8和IE7也不会得到过滤器。