当前位置: 首页 > 图文教程 > 网页制作 > CSS样式表 > 兼容浏览器的网页细线表格设计

CSS样式表
css position: absolute、relative详解
实用CSS 文字收集
CSS之少用继承,多用组合
IE下href 的 BUG问题
firefox的超链接点击去除扩大的难看虚线的解决方法
css li 超出隐藏代码
多浏览器支持CSS 容器内容超出(溢出)支持自动换行
IE6不能正常解析CSS文件问题的解决方法及原因分析
css 表单效果
div+css模拟表格效果代码
ie6 注释引起的问题
CSS Hack 汇总快查
CSS小例子(只显示下划线的文本框,像文字一样的按钮)
另一个角度谈谈DIV+CSS
单行图片文字垂直居中问题:实战
符合标准的div+css制作的弹出菜单
DIV+CSS常见错误汇总
基本的页面设计元素布局比例
CSS学习者:2008年不要作浮躁的人
关于学习DIV+CSS的一些精妙问答

CSS样式表 中的 兼容浏览器的网页细线表格设计


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-03-17   浏览: 358 ::
收藏到网摘: n/a

细线表格如果单纯设置边框,很难保证浏览器兼容。常见的做法是利用 CSS2 的 "border-collapse:collapse;" 属性合并表格边框;并对 table 元素设置左边框和上边框,对 th 和 td 元素设置右边框和下边框。

Markup:

<table>
    <tr>
        <th>table head (row1, col1)</th>
        <th>table head (row1, col2)</th>
        <th>table head (row1, col3)</th>
    </tr>
    <tr>
        <td>table data (row1, col1)</td>
        <td>table data (row1, col2)</td>
        <td>table data (row1, col3)</td>
    </tr>
    <tr>
        <td>table data (row2, col1)</td>
        <td>table data (row2, col2)</td>
        <td>table data (row2, col3)</td>
    </tr>
</table>

CSS:

table{border-collapse:collapse;border-spacing:0;border-left:1px solid #888;border-top:1px solid #888;background:#efefef;}
th,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}