Scoping CSS inline styles with css-scope-inline - LogRocket Blog
Briefly

the traditional style tag typically needs to be placed within the head tag, so all styling rules within a particular style tag affect the whole HTML page by default.
Using a unique DOM identifier, following BEM, or using frontend frameworks are possible workarounds for inline style tag scoping. In this article, however, we'll cover the css-scope-inline library, which offers a simple JavaScript code snippet to scope your inline style tags without adding a build step to your vanilla CSS/HTML project.
There are two predominant methods for adding CSS definitions to HTML pages: Creating separate vanilla CSS stylesheets and using inline style tags within the HTML document body and inside HTML elements to keep both element structures and styling definitions in the same place for better readability.
Read at LogRocket Blog
[
add
]
[
|
|
]