【问题标题】:Cell border not showing in IE9 when filter gradient is applied to cells将滤镜渐变应用于单元格时,IE9 中不显示单元格边框
【发布时间】:2012-03-24 20:13:21
【问题描述】:

我正在创建一个网格列表,使用标题行(即第一行)应用的 CSS 渐变。还应用了边框。

在应用渐变滤镜之前,所有浏览器都会显示边框,但是在应用渐变滤镜之后,IE 会隐藏边框!其他浏览器都可以。

CSS 代码如下:

.list tr.titlerow, .list .titlerow th {
    border: 1px solid #a0a0a0;
    height:25px;
    padding:2px;
    filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#EBEBEB', endColorstr='#ffffff');/*For IE7-8-9*/  
    background: -moz-linear-gradient(top, #EBEBEB 0%, #fff 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#EBEBEB), color-stop(100%,#fff)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #EBEBEB 0%,#fff 100%); /* Chrome10+,Safari5.1+ */
    background: -ms-linear-gradient(top, #EBEBEB 0%,#fff 100%); /* IE10+ */
    background: -o-linear-gradient(top, #EBEBEB 0%,#fff 100%); /* Chrome10+,Safari5.1+ */


}

谁能帮我解决这个问题?

【问题讨论】:

    标签: html css filter internet-explorer-9


    【解决方案1】:

    IE 过滤器通常会无缘无故地完全搞砸其他事情。有时应用一个过滤器会杀死另一个过滤器 - 它们甚至不能很好地相互配合,更不用说正确的 CSS!

    我不会使用过滤器并尝试以正确的方式做事,而是使用条件 cmets 或其他类似机制回退到基于图像的 IE 渐变。

    【讨论】:

      【解决方案2】:

      试试这个方法:-

          .list tr.titlerow, .list .titlerow th
          {
              border: 1px solid #a0a0a0;
              height:25px;
              padding:2px;
              background: -moz-linear-gradient(top, #EBEBEB 0%, #fff 100%); /* FF3.6+ */
              background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#EBEBEB), color-stop(100%,#fff)); /* Chrome,Safari4+ */
              background: -webkit-linear-gradient(top, #EBEBEB 0%,#fff 100%); /* Chrome10+,Safari5.1+ */
              background: -ms-linear-gradient(top, #EBEBEB 0%,#fff 100%); /* IE10+ */
              background: -o-linear-gradient(top, #EBEBEB 0%,#fff 100%); /* Chrome10+,Safari5.1+ 
      */
              filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#EBEBEB', endColorstr='#ffffff'); /* IE6 & IE7 */ 
              -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#EBEBEB', endColorstr='#ffffff')";    /* IE8 */ 
      
          }
      

      【讨论】:

        【解决方案3】:

        只需添加位置:相对;

        .container 
        {
            display: table;
            background-color: lightblue;
            border-spacing: 5px 0;
        }
        
        .container > a
        {
            display: table-cell;
            width: 60px;
            height: 25px;   
           
            border-style: solid;
            border-width: 1px;
            
        	border-color:#adae9c;
        	background: #e4e7dd; /* Old browsers */
        	background: -moz-linear-gradient(top,  #fefefe 0%, #e4e7dd 100%); /* FF3.6+ */
        	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fefefe), color-stop(100%,#e4e7dd)); /* Chrome,Safari4+ */
        	background: -webkit-linear-gradient(top,  #fefefe 0%,#e4e7dd 100%); /* Chrome10+,Safari5.1+ */
        	background: -o-linear-gradient(top,  #fefefe 0%,#e4e7dd 100%); /* Opera 11.10+ */
        	background: -ms-linear-gradient(top,  #fefefe 0%,#e4e7dd 100%); /* IE10+ */
        	background: linear-gradient(to bottom,  #fefefe 0%,#e4e7dd 100%); /* W3C */
        
            filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefe',endColorstr='#e4e7dd',GradientType=0 ); /* IE6-9 */
            /*get around bug with IE9 that won't render the border if combined with table-cell and using a filter*/
            position: relative;
        }
        <div class='container'>
            <a>test1</a>
            <a>test2</a>
        </div>

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2011-03-28
          • 2014-09-14
          • 1970-01-01
          • 2012-04-23
          • 1970-01-01
          • 2011-07-03
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多