ChenXiu Posted August 3, 2022 Share Posted August 3, 2022 (edited) Given the following html table, are both css rules 100% identical in effect? Why? Or why not? <table class="classname"><tr><td>Hello World</td></tr></table> table.classname td { ......... } - versus -.classname td { ......... } Thank you. Edited August 3, 2022 by ChenXiu Quote Link to comment https://forums.phpfreaks.com/topic/315130-classname-versus-elementclassname/ Share on other sites More sharing options...
requinix Posted August 3, 2022 Share Posted August 3, 2022 1. https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity 2. <table class="classname"> <tr> <td>This has the class</td> </tr> </table> <div class="classname"> <table> <tr> <td>So does this</td> </tr> </table> </div> Quote Link to comment https://forums.phpfreaks.com/topic/315130-classname-versus-elementclassname/#findComment-1598917 Share on other sites More sharing options...
ChenXiu Posted August 7, 2022 Author Share Posted August 7, 2022 Thank you! I also enjoyed reading the mathematics behind specificity. Cool! Quote Link to comment https://forums.phpfreaks.com/topic/315130-classname-versus-elementclassname/#findComment-1599105 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.