Heim  >  Artikel  >  Web-Frontend  >  求教如何改变一个td里的label和a的字体颜色_html/css_WEB-ITnose

求教如何改变一个td里的label和a的字体颜色_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:01:532710Durchsuche

<!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><style type="text/css">.change td:hover{	color:#56ae2e;}#table1{	border:none;width:102%;height:100%; border-style:none; margin-left:-2px;margin-top:-2px;	}#table1 tr{	width:100%;height:5.5%; text-align:center;font-size:16px;	}#table1 tr td:hover{	color:#56ae2e;	}	#table1 tr td a{	font-weight: bold; color: #2f2e2e;text-decoration: none;font-size:16px; margin-right:25%;		}#table1 tr td span:hover{		color:#56ae2e;		}</style><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body><div id="div1" style="float:left;width:100px;height:600px;margin-top:5px;border:solid;border-color:#56ae2e;border-width:2px;">               <table id="table1" >                   <tr bgcolor="#56ae2e"><td> <a href="#" style="font-weight: bold; color:#FFFFFF;text-decoration: none;" >农资卖场</a></td></tr>                   <tr class="change"><td><a href="#" >种子</a><label>></label></td></tr>                   <tr class="change"><td><span id="span1">  <a href="#">农药</a><label>></label></span></td></tr>                   <tr><td> <a href="#">化肥</a><label>></label></td></tr>                   <tr><td> <a href="#">饲料</a><label>></label></td></tr>                   <tr><td> <a href="#">兽药</a><label>></label></td></tr>                   <tr><td> <a href="#">农机</a><label>></label></td></tr>               </table>           </div></body></html>



求助,怎么设置css能同时在鼠标经过的时候更改一个td里的a和label的颜色,麻烦各位大大。。


回复讨论(解决方案)

#table1 tr td:hover a{color: #f00;}#table1 tr td:hover label{color: #f00;}

<!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>    <style type="text/css">        .change td:hover{            color:#56ae2e;}        #table1{            border:none;width:102%;height:100%; border-style:none; margin-left:-2px;margin-top:-2px;        }        #table1 tr{            width:100%;height:5.5%; text-align:center;font-size:16px;        }        #table1 tr td:hover{            color:#56ae2e;        }        #table1 tr td:hover a{color: #f00;}        #table1 tr td:hover label{color: #f00;}        #table1 tr td a{            font-weight: bold; color: #2f2e2e;text-decoration: none;font-size:16px; margin-right:25%;        }        #table1 tr td span:hover{            color:#56ae2e;        }    </style>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>无标题文档</title></head><body><div id="div1" style="float:left;width:100px;height:600px;margin-top:5px;border:solid;border-color:#56ae2e;border-width:2px;">    <table id="table1" >        <tr bgcolor="#56ae2e"><td> <a href="#" style="font-weight: bold; color:#FFFFFF;text-decoration: none;" >农资卖场</a></td></tr>        <tr class="change"><td><a href="#" >种子</a><label>></label></td></tr>        <tr class="change"><td><span id="span1">  <a href="#">农药</a><label>></label></span></td></tr>        <tr><td> <a href="#">化肥</a><label>></label></td></tr>        <tr><td> <a href="#">饲料</a><label>></label></td></tr>        <tr><td> <a href="#">兽药</a><label>></label></td></tr>        <tr><td> <a href="#">农机</a><label>></label></td></tr>    </table></div></body></html>


感谢!新手刚接触硬上架好苦逼啊..


感谢!新手刚接触硬上架好苦逼啊..
不客气,解决了就结贴,另外可以看一下我这个系列教程,对新手应该有帮助:
http://www.cnblogs.com/jikey/p/3613082.html
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn