Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
            
- /css/selectors/nth-last-child-invalid.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<html>
  <head>
    <title>CSS Selectors: :nth-last-child() with no argument</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <style>
      #target:nth-last-child() { color: red; }
      #target { color: green; }
    </style>
  <head>
  <body>
  <body>
    <div id="target">Test passes if this line is green.</div>
    <script>
  test(() => {
    assert_equals(getComputedStyle(target).color, 'rgb(0, 128, 0)');
  });
    </script>
  </body>
</html>