【问题标题】:IE7 THEAD Tag StylingIE7 THEAD 标签样式
【发布时间】:2014-01-14 15:26:17
【问题描述】:

此代码在 IE8、Firefox、Chrome 等中运行良好...但 ie7 无法识别此行:

.defaulttable thead{border-right:55px solid #c7c9cf;}

因为我在 ie7 中看到了无边框。我怎么解决这个问题 ?

HTML:

<table id="search_table" class="mtm defaulttable">
   <thead>
     <tr class="sortlinks">
        <td>Hello 1</td>
        <td>Hello 2</td>
     </tr>
   </thead>
   <tbody>
       ...........................
</table>

CSS:

.defaulttable {width:100%;border-collapse:collapse;}
.defaulttable thead td{font-weight:bold;background: url('/static/images/grey_fade_back.png') repeat-x 0 -2px;white-space:nowrap;}
.defaulttable thead{border-right:55px solid #c7c9cf;}
.defaulttable tbody td{border-right:1px solid #c7c9cf;}
.defaulttable td {border-top:1px solid #c7c9cf;border-bottom:1px solid #c7c9cf;border-left:1px solid #c7c9cf;padding:6px 8px 6px;}
.defaulttable .project_name{background-image:url('/static/images/mini/project.png');background-position:7px 7px;background-repeat:no-repeat;padding-left:30px}
.defaulttable .user{background-image:url('/static/images/mini/user.png');background-position:7px 7px;background-repeat:no-repeat;padding-left:30px}
.defaulttable .job_ad_title{background-image:url('/static/images/mini/pin.png');background-position:7px 8px;background-repeat:no-repeat;padding-left:30px}
.defaulttable .project_category div{}       
.defaulttable .odd{background:#EFEFEF url(/static/images/button-overlay.png) repeat-x scroll 0 0}
.defaulttable .hover{background:#FEFFAF url(/static/images/button-overlay.png) repeat-x scroll 0 0}
.defaulttable .selected{background:#99DFA2 url(/static/images/button-overlay.png) repeat-x scroll 0 0}
.defaulttable .sortlinks a{color:#444}
.defaulttable tfoot {}  

【问题讨论】:

    标签: css internet-explorer-7 internet-explorer-6


    【解决方案1】:

    您可以使用 conditional comments 专门针对 IE 7 的替代规则:

    <!--[if IE 7]>
    
        <style>
        /* alternate style rules for IE 7 */
        table thead tr th { /* style the `th` not the `thead` */ }
        </style>
    
    <![endif]-->
    

    值得注意的是,对于表格标题,th 元素比 td 更合适(因为它实际上是一个“表格标题”)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-19
      • 1970-01-01
      • 1970-01-01
      • 2011-02-22
      • 2013-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多