日期:2014-05-17  浏览次数:20740 次

求一 css 控制表格中的 td ,对整个 td 单元格产生超链接效果,多谢了


我的 css.css 文件如下:

--------------------------

A.indexlink:link{
  COLOR: #000000;
  text-decoration: none;
   
}
A.indexlink:visited {
  COLOR: #000000;
  text-decoration: none;
   
}
A.indexlink:active {
  COLOR: #ffffff;
text-decoration: none;
   
}
A.indexlink:hover {
  COLOR: #ffffff;
  text-decoration: none;
   
}
.Mouse_OverColor{
border:1 double;border-color:#000000 #000000 #000000 #000000;background:#8F4586

}
.Mouse_OutColor{
border:1 double;border-color:#000000 #000000 #000000 #000000;background:#FF9955

}

---------------------------

我的 index.htm 文件如下:

<td align="center" onMouseOver="this.className='Mouse_OverColor';" onMouseOut="this.className='Mouse_OutColor';"><a class="indexlink" href="dd.aspx">公司简介</a></td>

------------------------------

说明:当鼠标进入 td 内时,触发 onMouseOver ,td 的背景色变为:#8F4586 
  超链接 “公司简介” 的 class="indexlink" ,当鼠标放在上面时,文字变为白色。

------------------------------

我想实现的是:

当鼠标进入 td 内时,td 的背景色变为:#8F4586 ,但同时我想对整个 td 进行超链接 href="dd.aspx“


这要如何办呢?




------解决方案--------------------
对td内的a标记设置为块级,长度和高度设置为100%就可以了。再a:hover设置属性就可以了
------解决方案--------------------
display:block