I have a component that is being passed an integer value as a property, and I'm trying to create a CSS rule that uses it in its :nth-of-type selector:
---
interface Props {
active?: number;
}
const { active = 1 } = Astro.props;
---
<style>
nav a:nth-of-type({active}) {
/* ... */
}
</style>```
I have also tried passing it in as a CSS variable, as per https://docs.astro.build/en/guides/styling/#css-variables, however the selector itself seems to not support CSS variables as valid syntax:
```<style define:vars={{active}}>
nav a:nth-of-type(var(--active)) {
/* ... */
}
</style>```
Sadly neither of these work. Is there a clean way to do this? I would prefer to avoid applying these CSS rules via JS...