W3C home > Mailing lists > Public > www-style@w3.org > July 2015

Re: [selectors] Need to clearly define matching for :first-child, :nth-*, etc

From: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Date: Wed, 15 Jul 2015 21:01:46 +0200
To: www-style@w3.org
Message-ID: <55A6AE1A.60100@disruptive-innovations.com>
On 15/07/2015 20:47, Tab Atkins Jr. wrote:

> (But seriously, what are people misinterpreting this as? Do they think
> :first-child shouldn't match an element without a parent? Switching
> away from the "parent/child" language was *explicitly* meant to avoid
> that sort of misinterpretation!)

Have you tried the following:

  <html>
    <head>
    <style>
      html { color: red }
      html:first-child{ color:green }
    </style>
    </head>
    <body>
      <p>foo</p>
    </body>
  </html>

The paragraph is red in Firefox and Chrome. :first-child does NOT match
the root element because it has no parent...

</Daniel>
Received on Wednesday, 15 July 2015 19:02:10 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:18 UTC