I know how to refer to a tag with an id or class in css
<table id="cooltable">
<tr>
<td></td>
<td></td>
</tr>
</table>
so in css, u refer this <table> by
table#cooltable{
...
}
However, if I want to refer the <td> in <table> in css, how do I that?
In CSS, the space character on its own means “descendant”. For example, this refers to every
tdthat is a descendant oftable#cooltable:You can also use the
>operator: this is more strict, and only applies to direct children. To achieve the same effect using this, you would write:In this case, I’d prefer the first option, but there are some situations—multiple layers of
<div>tags, for example, or nested tables, where this is a very useful tool.