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

CSS样式表
网页设计布局基础
Lesson01_01 HTML基础
HTML的全局架构标签
Lesson01_03 注释与特殊字符
Lesson01_04 格式标签与文本标签
Lesson01_05 HTML中的超链接
Lesson01_07 图像标签
Lesson02_01 表格标签
Lesson02_02 帧标签
Lesson02_03 表单标签
Lesson02_04 表单标签(2)
Lesson02_05 头元素
Lesson02_06 分区标签
Lesson03_02 样式规则选择器
学习标准——笔记
用好href的target属性
常用CSS集合
教你如何用CSS来控制网页字体的显示样式
用CSS解决中英文混合字符串的截取省略问题的解决办法
鼠标移动到超链接上的效果

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-03-17   浏览: 345 ::
收藏到网摘: 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;}