【问题标题】:Removing white corners on button in IE删除IE中按钮上的白角
【发布时间】:2013-04-04 20:19:05
【问题描述】:

我为我的网站创建了一个自定义按钮,在 chrome 中看起来不错

但在 IE 中它有白角

我已尽我所能去除白角,但我不知道如何。

这是我在下面使用的样式:

   <input type="submit" value="Search" class="button1">

CSS 规则是:

   .button1{
        height:26px;  font-size:12px;  font-weight:bold;   cursor:pointer; float:right;   
        padding-left:10px;   padding-right:10px;  margin:2px;  font-family:verdana,arial, helvetica, sans-serif; 
        border:1px solid #000;   border-width:1px;   float:left;
        -webkit-border-top-right-radius:    5px;    -moz-border-radius-topright:    5px;   border-top-right-radius:     5px;
        -webkit-border-bottom-right-radius: 5px;    -moz-border-radius-bottomright: 5px;   border-bottom-right-radius:  5px;
        -webkit-border-top-left-radius:     5px;    -moz-border-radius-topleft:     5px;   border-top-left-radius:      5px;
        -webkit-border-bottom-left-radius:  5px;    -moz-border-radius-bottomleft:  5px;   border-bottom-left-radius:   5px;
        background-color:#F00;
        background: rgb(254,255,232); /* Old browsers */
        background: -moz-linear-gradient(top,  rgba(254,255,232,1) 0%, rgba(214,219,191,1) 100%); /* FF3.6+ */
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,255,232,1)), 
            color-stop(100%,rgba(214,219,191,1))); /* Chrome,Safari4+ */
        background: -webkit-linear-gradient(top,  rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Chrome10+,Safari5.1+ */
        background: -o-linear-gradient(top,  rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Opera 11.10+ */
        background: -ms-linear-gradient(top,  rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* IE10+ */
        background: linear-gradient(to bottom,  rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* W3C */
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feffe8', endColorstr='#d6dbbf',GradientType=0 ); /* IE6-9 */


    }

【问题讨论】:

  • 我将为 IE 调用/创建一个background-image
  • 您在哪个版本的 IE 中看到这个问题?
  • + 你可以使用border-radius:5px; :P
  • @JonahBishop 据我所知,问题在于 IE9、8、7
  • @l2aelba 是的,我应该清理一下

标签: html css linear-gradients


【解决方案1】:

这是this question 的副本。

给出的解决方案建议添加一个包装 div 来处理角落和 IE 无法混合和匹配。 http://jsfiddle.net/UME84/

.corners {
    border:1px solid #000;
    border-radius:5px;
    margin:2px;
    overflow:hidden;
    float:left;
}

在 IE9 中测试。

【讨论】:

  • 感谢链接,有趣的是 jsfiddle 似乎不支持旧的 IE 浏览器。
  • @mk_89:当您需要为旧版本的 IE 共享 jsfiddle 链接时,请使用演示的独立版本,即常规 URL 加上“显示”。例如:jsfiddle.net/abcde/1/show
  • 很高兴知道。我会这样做的。
【解决方案2】:

对于 IE9-

<!--[if gte IE 9]><style type="text/css">.button1 {filter: none;}</style><![endif]-->

或在所有 IE 中设置border-radius:0px;

    <!--[if IE]>
       <style type="text/css">
        .button1 {
          filter:none;
          border-radius:none;
        }
       </style>
    <![endif]-->

CSS:

.button1{
        height:26px;cursor:pointer;
        padding-left:10px;
        padding-right:10px;
        margin:2px;
        font:bold 12px verdana,arial,helvetica,sans-serif;
        float:left;
        border:1px solid #000;
        border-radius:5px;
        background: #feffe8;
        background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZlZmZlOCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNkNmRiYmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
        background: -moz-linear-gradient(top, #feffe8 0%, #d6dbbf 100%);
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#feffe8), color-stop(100%,#d6dbbf));
        background: -webkit-linear-gradient(top, #feffe8 0%,#d6dbbf 100%);
        background: -o-linear-gradient(top, #feffe8 0%,#d6dbbf 100%);
        background: -ms-linear-gradient(top, #feffe8 0%,#d6dbbf 100%);
        background: linear-gradient(to bottom, #feffe8 0%,#d6dbbf 100%);
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feffe8', endColorstr='#d6dbbf',GradientType=0 )
}

PS:未经测试

请带上还在使用IE的老IE用户下载Google Chrome Frame

【讨论】:

  • 你能测试我的吗? @mk_89
  • 我做到了,if 语句是所有必要的,每个浏览器上的按钮看起来都不同,但我必须调查一下
  • 对不起,我的 mac 上没有任何 IE @mk_89 我的未经测试
猜你喜欢
  • 1970-01-01
  • 2011-08-14
  • 1970-01-01
  • 2016-11-10
  • 2022-10-16
  • 1970-01-01
  • 1970-01-01
  • 2018-05-30
  • 1970-01-01
相关资源
最近更新 更多