非IE浏览器中table标签出现边框的问题

问题:在非IE浏览器中,如果使用gridview来生成table显示数据的话,通常会在生成的table中出现边框的情况,如下图

我们打开firebug这个插件来看看html代码,发现

在gridview生成的table中,会多了一个rules这个属性,我们来查一下html手册,发现

RULES Attribute | rules Property

Internet Development Index

Sets or retrieves which dividing lines (inner borders) are displayed.

Syntax

HTML <TABLE RULES = sRule... >
Scripting TABLE.rules [ = sRule ]

Possible Values

sRule String that specifies or receives one of the following values.
all Borders are displayed on all rows and columns.
cols Borders are displayed between all table columns.
groups Horizontal borders are displayed between all tHead, tBody, and tFoot objects; vertical borders are displayed between all colGroup objects.
none All interior table borders are removed.
rows Horizontal borders are displayed between all table rows.

结果很明显了,当rules的属性值为all的时候,是会出现行和列的边框的,那么我们怎么解决这个问题呢??

我们发现,在gridview的属性中,有一个叫做GridLines的,它的值默认为Both

我们修改一下,把属性值设置为None,如下图所示

我们再看看效果,发现原来在table中的边框已经没有了

原文地址:https://www.cnblogs.com/cookies9/p/1959689.html