:first-child pseudo‑class and the <caption> element — :first-child et <caption> sont dans un bateau

case solved, thanks for the answers!

So… I was answering a rant from one of our readers, and I came across something I can’t find any answer to, but “WTF?” (Excuse my French).

When using the following codes, the <caption> element looks like being ignored by browsers as the first child of <table>; I made a test case in the codeplay section:

CSS

table tr:first-child {
  color: #f00;
}

HTML

<table>
  <caption lang="it">è un'ingiustizia però</caption>
  <tr>
    <th>code</th>
    <th>comment</th>
  </tr>
</table>

Since I can’t find any reason why this would be the case, I’ll ask the Web: Dear lazy Web, do you have any answer to this question? Not “WTF?”, but “Why is <caption> ignored as the first child of <table>?

The DOM in Firefox says it’s children[0] of <table>, which is fine with me! But why would the rendering behave an other way?