html - CSS: how to cascade class-specific style to children -
suppose have html table has been assigned class dependency_table
.
how can style tr
, th
, , td
children of that specific table without having put class="dependency_table"
in of child tags?
here have tried far:
/* --- dependency table styling --- */ .dependency_table { border-collapse: collapse; color: pink; } .dependency_table ~ td { background: #fafafa; text-align: center; } .dependency_table ~ th{ background: #dfdfdf; /* darken header bit */ font-weight: bold; }
the general sibling selector hasn't worked me yet syntax. correct way of doing this?
if understand correctly want this:
/* --- dependency table styling --- */ .dependency_table { border-collapse: collapse; color: pink; } .dependency_table td { #your style } .dependency_table th{ #your style } .dependency_table tr{ #your style }
Comments
Post a Comment