How to make the th part of the class selector also work
.fancy th{ color:#f60;background:#666;}
.fancy td{ color:#f60;background:#666;}
=》Change to the following. Because it is th td in class .table
.table .fancy th{ color:#f60;background:#666;}
.table .fancy td{ color:#f60;background:#666;}
.fancy th{ color:#f60;background:#666;}
.fancy td{ color:#f60;background:#666;}
=》Change to the following . Because it is th td in class .table
.table .fancy th{ color:#f60;background:#666;}
.table .fancy td{ color:#f60;background:#666;}
@kongwei521
.fancy th{ color:#f60;background:#666;}
.fancy td{ color:#f60;background:#666;}
=》Change into the following. Because it is th td in class .table
.table .fancy th{ color:#f60;background:#666;}
.table .fancy td{ color:#f60;background:#666;}
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style> .table .fancy th {color: #f60;background: #666;} .table .fancy td { color: #f60;background: #666; } .table { border: 1px dotted #000; } </style></head><body> <form id="form1" runat="server"> <table class="table" border="1"> <!--第一行--> <tr class="fancy"> <th>姓名</th> <th>性别</th> <th>年龄</th> <th>名族</th> </tr> <!--第二行--> <tr class="fancy"> <td>张峰</td> <td>男</td> <td>19</td> <td>汉族</td> </tr> <!--第三行--> <tr class="fancy"> <td>李惠</td> <td>女</td> <td>18</td> <td>回族</td> </tr> </table> </form></body></html>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style> .table .fancy th {color: #f60;background: #666;} .table .fancy td { color: #f60;background: #666; } .table { border: 1px dotted #000; } </style></head><body> <form id="form1" runat="server"> <table class="table" border="1"> <!--第一行--> <tr class="fancy"> <th>姓名</th> <th>性别</th> <th>年龄</th> <th>名族</th> </tr> <!--第二行--> <tr class="fancy"> <td>张峰</td> <td>男</td> <td>19</td> <td>汉族</td> </tr> <!--第三行--> <tr class="fancy"> <td>李惠</td> <td>女</td> <td>18</td> <td>回族</td> </tr> </table> </form></body></html>
姓名 | 性别 | 年龄 | 名族 |
---|---|---|---|
张峰 | 男 | 19 | 汉族 |
李惠 | 女 | 18 | 回族 |
真搞不懂
你少了 这个吧
真搞不懂
<!DOCTYPE html><html><head> <style> <!--类选择器--> .table .fancy th { color:#f60; background:#666; } .table .fancy td { color:#f60; background:#666; } .table { border:1px dotted #000; } </style></head><body> <form> <table class="table" border="1"> <!--第一行--> <tr class="fancy" > <th>姓名</th> <th>性别</th> <th>年龄</th> <th>名族</th> </tr> <!--第二行--> <tr class="fancy"> <td>张峰</td> <td>男</td> <td>19</td> <td>汉族</td> </tr> <!--第三行--> <tr class="fancy"> <td>李惠</td> <td>女</td> <td>18</td> <td>回族</td> </tr> </table> </form></body></html>
Change the comment of //html
=》
to /*Class Selector*/
You can copy it directly Paste and run to see what the result is. Anyway, it doesn’t work on my machine, so I’m confused. . .
Just copy and paste and run it to see what the result is. Anyway, it doesn’t work on my machine, so I’m confused. . .