CSS 鼠标经过时改变table所在行的颜色
来源:互联网 发布:匡恩网络 奇葩 编辑:程序博客网 时间:2024/05/16 19:39
<html><head><style type="text/css">#customers { font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; width:100%; border-collapse:collapse; }#customers td, #customers th { font-size:1em; border:1px solid #98bf21; padding:3px 7px 2px 7px; }#customers th { font-size:1.1em; text-align:left; padding-top:5px; padding-bottom:4px; background-color:#A7C942; color:#ffffff; }</style></head><body><table id="customers"><tr><th>Company</th><th>Contact</th><th>Country</th></tr><tr onmouseover="style.backgroundColor='#FF9900'" onmouseout="style.backgroundColor='#FFFFFF'"><td>Apple</td><td>Steven Jobs</td><td>USA</td></tr><tr class="alt"><td>Baidu</td><td>Li YanHong</td><td>China</td></tr><tr onmouseover="style.backgroundColor='#FF9900'" onmouseout="style.backgroundColor='#FFFFFF'"><td>Google</td><td>Larry Page</td><td>USA</td></tr><tr class="alt" onmouseover="style.backgroundColor='#FF9900'" onmouseout="style.backgroundColor='#FFFFFF'"><td>Lenovo</td><td>Liu Chuanzhi</td><td>China</td></tr><tr onmouseover="style.backgroundColor='#FF9900'" onmouseout="style.backgroundColor='#FFFFFF'"><td>Microsoft</td><td>Bill Gates</td><td>USA</td></tr><tr class="alt" onmouseover="style.backgroundColor='#FF9900'" onmouseout="style.backgroundColor='#FFFFFF'"><td>Nokia</td><td>Stephen Elop</td><td>Finland</td></tr></table></body></html>