You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>In CSS Modules, selectors are scoped by default.</p>
22
24
<p>The following component uses two classes, <strong>.root</strong> and <strong>.text</strong>, both of which would typically be too vague in a larger project.</p>
23
25
<p>CSS Module semantics ensure that these <strong>classes are locally scoped</strong> to the component and don't collide with other classes in the global scope.</p>
24
26
<ScopedSelectorsDemo/>
25
27
28
+
<hrclassName={styles.hr}/>
29
+
26
30
<h2>Global Selectors</h2>
27
31
<p>Although they should be used as sparingly as possible, <strong>global selectors are still available when required.</strong></p>
28
32
<p>The following component styles all <strong><p></strong> tags nested inside it.</p>
29
33
<GlobalSelectorsDemo/>
30
34
35
+
<hrclassName={styles.hr}/>
36
+
31
37
<h2>Class Inheritance</h2>
32
38
<p>Both of the components below have <strong>locally scoped CSS</strong> that <strong>inherits from a common set of CSS Modules.</strong></p>
33
39
<p>Since <strong>CSS Modules can be composed</strong>, the resulting markup is optimised by <b>reusing classes between components</b>.</p>
34
-
<ClassInheritance/>
40
+
<ClassInheritanceDemo/>
41
+
42
+
<hrclassName={styles.hr}/>
35
43
36
44
<h2>Inheritance Overrides</h2>
37
45
<p>When extending classes, <strong>inherited style properties can be overridden</strong> as you'd expect.</p>
38
46
<p>The following component extends two different classes, but provides overrides which then take precedence.</p>
39
-
<InheritanceOverrides/>
47
+
<InheritanceOverridesDemo/>
48
+
49
+
<hrclassName={styles.hr}/>
40
50
41
51
<h2>Scoped Animations</h2>
42
52
<p>CSS Modules even provide <strong>locally scoped animations</strong>, which are typically defined in the global scope.</p>
43
53
<p>The animation's keyframes are private to the animations module, only exposed publicly via a class which this component inherits from.</p>
0 commit comments