I am using Astro and Tailwind CSS.
From an Astro component an external script is added which create some HTML dom elements (and its styling).
// MyComponent.astro
<script is:inline src={import.meta.env.PUBLIC_MY_SCRIPT}></script>
In the dom it renders like:
<div class"my-ui-uicontainer">
// More code..
</div>
I need to override the applied styling of .my-ui-uicontainer.
I tried the following but none of them work:
// main.css
@layer base {
.my-ui-uicontainer {
@apply !bg-blue-500;
}
}
And I tried, just adding the selector:
// main.css
.my-ui-uicontainer {
@apply !bg-blue-500;
}
Or with the Tailwind theme() function:
// main.css
@layer base {
.my-ui-uicontainer {
background-color: theme(colors.blue.500) !important;
}
}
Also I tried the same in the Astro component (in the style tag):
// MyComponent.astro
<style>
.my-ui-uicontainer {
@apply !bg-blue-500;
}
</style
Or the theme() function:
// MyComponent.astro
<style>
.my-ui-uicontainer {
background-color: theme(colors.blue.500) !important;
}
</style
Non of them works?
What is the best way to do this with Astro and Tailwind css?