CSS selector class and element order

匿名 (未验证) 提交于 2019-12-03 01:46:01

问题:

In a HTML table with class of 'testtable', is there any difference between selecting a element in that table with the following two css selectors?

.testtable td{} 

and

td.testtable{} 

回答1:

.testtable td{} selects a td that has a parent with the class testtable, for example:

<table class="testtable">     <td>I'm selected</td> </table> 

td.testtable{} selects a td that has the class testtable, for example:

<table>     <td class="testtable">I'm selected</td> </table> 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!