I'm an amateur in web development and I'm having problem styling my page properly. My elements <th> and <td> get styled by the .lookup_result th, td {} instead of .form_output . entry_cache th, td {}. Do I understand CSS wrong if I expect the <th> and <td> elements to only get the style from the classes of its "parents" and not a class that is not related to my entry?
My HTML:
<div class="form_output">
<table class="entry_cache">
<th>
Header
</th>
<td>
Data
</td>
</table
</div>
My CSS:
.form_output .entry_cache th, td {
width: 10em;
text-align: left;
}
.lookup_result th, td {
width: 7em;
text-align: right;
}