| <!DOCTYPE html> | |
| <title>@nest | basic</title> | |
| <link rel="author" title="Adam Argyle" href="mailto:argyle@google.com"> | |
| <link rel="help" href="https://drafts.csswg.org/css-nesting-1/"> | |
| <link rel="match" href="nesting-ref.html"> | |
| <style> | |
| .test { | |
| background-color: red; | |
| width: 100px; | |
| height: 100px; | |
| display: grid; | |
| } | |
| .test-1 { | |
| & > div { | |
| background-color: green; | |
| } | |
| } | |
| .test-2 { | |
| @nest & > div { | |
| background-color: green; | |
| } | |
| } | |
| .test-3 { | |
| @nest & .test-3-child { | |
| background-color: green; | |
| } | |
| } | |
| span > b { | |
| @nest .test-4 section > & { | |
| display: inline-block; | |
| background-color: green; | |
| width: 100%; | |
| height: 100%; | |
| } | |
| } | |
| .test-5 { | |
| @media (min-width: 50px) { | |
| background-color: green; | |
| } | |
| } | |
| .test-6 { | |
| &.test { | |
| background-color: green; | |
| } | |
| } | |
| .test-7, .t7- { | |
| & + .test-7-child, &.t7-- { | |
| background-color: green; | |
| } | |
| } | |
| .test-8 { | |
| & { | |
| background-color: green; | |
| } | |
| } | |
| .test-9 { | |
| &:is(.t9-, &.t9--) { | |
| background-color: green; | |
| } | |
| } | |
| .test-10 { | |
| @supports (display: grid) { | |
| background-color: green; | |
| } | |
| } | |
| body * + * { | |
| margin-top: 8px; | |
| } | |
| </style> | |
| <body> | |
| <p>Tests pass if <strong>block is green</strong></p> | |
| <div class="test test-1"><div></div></div> | |
| <div class="test test-2"><div></div></div> | |
| <div class="test test-3"><div class="test-3-child"></div></div> | |
| <div class="test test-4"> | |
| <section> | |
| <span><b></b></span> | |
| </section> | |
| </div> | |
| <div class="test test-5"><div></div></div> | |
| <div class="test test-6"><div></div></div> | |
| <div class="test t7- t7--"><div class="test-7-child"></div></div> | |
| <div class="test test-8"><div></div></div> | |
| <div class="test test-9 t9-- t9-"><div></div></div> | |
| <div class="test test-10"><div></div></div> | |
| </body> |