日期:2014-05-19  浏览次数:20418 次

在2005中如何用CSS控制gridview?
最好给个例子,CSS文件怎么写?简单的
.gridview{???}

------解决方案--------------------

.GridViewStyle
{
border-right: 2px solid #A7A6AA;
border-bottom: 2px solid #A7A6AA;
border-left: 2px solid white;
border-top: 2px solid white;
padding: 4px;
}

.GridViewStyle a
{
color: #FFFFFF;
}

.GridViewHeaderStyle th
{
border-left: 1px solid #EBE9ED;
border-right: 1px solid #EBE9ED;
}

.GridViewHeaderStyle
{
background-color: #5D7B9D;
font-weight: bold;
color: White;
}

.GridViewFooterStyle
{
background-color: #5D7B9D;
font-weight: bold;
color: White;
}

.GridViewRowStyle
{
background-color: #F7F6F3;
color: #333333;
}

.GridViewAlternatingRowStyle
{
background-color: #FFFFFF;
color: #284775;
}

.GridViewRowStyle td, .GridViewAlternatingRowStyle td
{
border: 1px solid #EBE9ED;
}

.GridViewSelectedRowStyle
{
background-color: #E2DED6;
font-weight: bold;
color: #333333;
}

.GridViewPagerStyle
{
background-color: #284775;
color: #FFFFFF;
}

.GridViewPagerStyle table /* to center the paging links*/
{
margin: 0 auto 0 auto;
}

-----------------------------------------------------
Atributos de estilo no Gridview
----------------------------------------------------

<asp:GridView CssClass= "GridViewStyle " runat= "server " >
<FooterStyle CssClass= "GridViewFooterStyle " />
<RowStyle CssClass= "GridViewRowStyle " />
<SelectedRowStyle CssClass= "GridViewSelectedRowStyle " />
<PagerStyle CssClass= "GridViewPagerStyle " />
<AlternatingRowStyle CssClass= "GridViewAlternatingRowStyle " />
<HeaderStyle CssClass= "GridViewHeaderStyle " />
</asp:GridView>

---------------------------------------------------
Referência ao arquivo de estilo a ser colocada na tag HEADER
----------------------------------------------------

<link href= "estilos.css " type= "text/css " rel= "Stylesheet " rev= "Stylesheet " />
------解决方案--------------------
先给你个.css 文件 你保存 在页面引用

BODY
{
color: #000000;
FONT-FAMILY: "Verdana ", "Arial ", "Helvetica ", "sans-serif ";
line-height: 125%;
margin-bottom:0px;
margin-left:0px;
margin-right:0px;
margin-top:0px;
font-size: 9pt;
background-color:White;
font-size:9pt;
text-align:center;
height:100%;
}

A.sort
{
FONT-SIZE: 10.2pt;
COLOR: white;
TEXT-DECORATION: none
}

A:link
{
font-size: 9pt;
color: #006699;
line-height: 15pt;
font-family: 宋体;
text-decoration: underline;
}

A:visited
{
FONT-SIZE: 9pt;
COLOR: #006699;
LINE-HEIGHT: 15pt;
FONT-FAMILY: 宋体;
TEXT-DECORATION: underline;
}

A:active
{
FONT-SIZE: 9pt;
COLOR: #ff0000;
LINE-HEIGHT: 15pt;
FONT-FAMILY