diff --git a/README.md b/README.md index 18d37e8..c80d0f6 100644 --- a/README.md +++ b/README.md @@ -249,3 +249,57 @@ It will produce `Return to Home` `Return back` + +## Understand Astro's scoped CSS + +By default, everything is scoped to the current custom component. This mean you can't style a custom child component. +If you do want to style a custom child component, there are two ways: + +- Using :global() +- Passing a class to the child component + +Passing a class will enable two things on one element of the child component (typically the root element): + +- It will now have the class +- It will also have the parent component CID (Astro's Scope-CSS ID) + +### Example + +We have two components: + +```html +// Component A + +
This is Component A
+This is Component B
+This is Component A
+This is Component B
+