CSS问题每行颜色不一样怎么弄呢

来源:百度知道 编辑:UC知道 时间:2024/05/28 13:21:37
我想把第一的链接变成灰色
第二行的链接变成白色
怎么弄啊

我的网页:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>

<body>
<h1> </h1>
<table width="200" border="0" align="center">
<tr id="1h">
<td><a href="#">谷歌</a></td>

通过id控制tr

#1h a{color:#999} //表示id为1h的层包含着的a平常状态下颜色为#999的灰色
#1h a:hover{color:#fff} //表示id为1h的层包含着的a链接鼠标覆盖的时候的颜色为白色

你可以以此类推给2h定样式

onMouseOver="this.style.backgroundColor='#FFFFCC'" onMouseOut="this.style.backgroundColor='#ffffff'"把这个代码放到tr中就可以了。 原先写错了。

#1h a{color:#666;}
#2h a{color:#fff;}

对你每一行都弄个不同的标记,然后再根据不同标记来定义a的样式啊