今天在写程序时,发现我们的项目中有一个关于GridView的样式。
不显示border时,还要判断浏览器。
我试图找到不用判断浏览器的解决办法。
1)
代码
.GridView_Main
{
width:100%;
border:0px;
}
.GridView_Header
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
border:solid 0px transparent;
}
.GridView_Row
{
background-color: transparent;
border:solid 0px transparent;
}
.GridView_Alter
{
background-color: aliceblue;
border:solid 0px transparent;
}
.GridView_Footer
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
border:solid 0px transparent;
}
.GridView_Pager
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
border:solid 0px transparent;
}
{
width:100%;
border:0px;
}
.GridView_Header
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
border:solid 0px transparent;
}
.GridView_Row
{
background-color: transparent;
border:solid 0px transparent;
}
.GridView_Alter
{
background-color: aliceblue;
border:solid 0px transparent;
}
.GridView_Footer
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
border:solid 0px transparent;
}
.GridView_Pager
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
border:solid 0px transparent;
}
<asp:GridView ID="ListGridView" runat="server"
BorderWidth="0">
用以上代码只有竖线没有去除,其他的线都去除了。
2)判断浏览器的方法去除border
代码
.GridView_Main
{
width:100%;
border:0px;
}
.GridView_Header
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
}
.GridView_Row
{
background-color: transparent;
}
.GridView_Alter
{
background-color: aliceblue;
}
.GridView_Footer
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
}
.GridView_Pager
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
}
.GridView_Item_Firefox
{
border:solid 1px transparent;
text-align:left;
}
.GridView_Item_IE
{
border:solid 0px transparent;
text-align:left;
}
{
width:100%;
border:0px;
}
.GridView_Header
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
}
.GridView_Row
{
background-color: transparent;
}
.GridView_Alter
{
background-color: aliceblue;
}
.GridView_Footer
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
}
.GridView_Pager
{
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
FONT-WEIGHT: bold;
COLOR: #263D83;
FONT-FAMILY: Verdana, Arial;
BACKGROUND-COLOR: #C8C8EE;
}
.GridView_Item_Firefox
{
border:solid 1px transparent;
text-align:left;
}
.GridView_Item_IE
{
border:solid 0px transparent;
text-align:left;
}
3) 使用GridLines="None"去除border. 这种方法可以去除所有的线。
<asp:GridView ID="ListGridView" runat="server" GridLines="None">