Open this example in the interactive library
Source code
<style>
.demo > :only-child {
background-color: #cffafe;
}
</style>
<div class="demo"><span class="tile">Only child</span></div>
Style exactly one child with native CSS. The preview includes a small shared demo stylesheet.
Open this example in the interactive library
<style>
.demo > :only-child {
background-color: #cffafe;
}
</style>
<div class="demo"><span class="tile">Only child</span></div>