If I change the order of elements in a sub selector it affects an element outside of the class.
Common HTML:
<input type='text'>
<hr>
<table class="mytable">
<tbody>
<tr><td><input type='text'></td></tr>
<tr><td><input type='text'></td></tr>
<tr><td><input type='text'></td></tr>
</tbody>
</table>
This CSS works (jsfiddle):
input {
margin: 0 0 2em;
}
table.mytable input,select,a {
margin: 0;
}
The following CSS causes the first input before the table to lose its margin simply by placing <select>
first in the sublist of elements (jsfiddle). That is the mytable class is activated (selected) for the first input box when it should not be.
input {
margin: 0 0 2em;
}
table.mytable select,input,a {
margin: 0;
}
I tested this in both Chrome and Firefox and they both act the same way. So is this a bug? or Can someone explain what I am missing?