使用CSS删除不需要的表单元格边框 [英] Removing unwanted table cell borders with CSS

查看:422
本文介绍了使用CSS删除不需要的表单元格边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪和令人沮丧的问题。对于简单的标记:

I have a peculiar and frustrating problem. For the simple markup:

<table>
    <thead>
        <tr><th>1</th><th>2</th><th>3</th></tr>
     </thead>
    <tbody>
        <tr><td>a</td><td>b></td><td>c</td></tr>
        <tr class='odd'><td>x</td><td>y</td><td>z</td></tr>
    </tbody>
</table>

我将不同的背景颜色值应用到 tr 和 tr 奇数元素。问题是在大多数浏览器中,每个单元格都有一个不需要的边框,不是任何表格行的颜色。只有在Firefox 3.5中,表在任何单元格中都没有边框。

I apply different background-color values to the thead, tr, and tr odd elements. The problem is that in most browsers, every cell has an unwanted border which is not the color of any of the table rows. Only in Firefox 3.5 does the table have no borders in any cell.

我只想知道如何在其他主要浏览器中移除这些边框,因此您在表格中看到的只有交替的行颜色。

I'd just like to know how to remove these borders in the other major browsers so that the only thing you see in the table are the alternating row colors.

感谢。

推荐答案

/ p>

You need to add this to your CSS:

table { border-collapse:collapse }

这篇关于使用CSS删除不需要的表单元格边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆