|
71 | 71 |
|
72 | 72 | // Adds the base typography styles, based on a config. |
73 | 73 | @mixin mat-base-typography($config, $selector: '.mat-typography') { |
74 | | - .mat-h1, .mat-headline, #{$selector} h1 { |
| 74 | + // Note that it seems redundant to prefix the class rules with the `$selector`, however it's |
| 75 | + // necessary if we want to allow people to overwrite the tag selectors. This is due to |
| 76 | + // selectors like `#{$selector} h1` being more specific than ones like `.mat-title`. |
| 77 | + .mat-h1, |
| 78 | + .mat-headline, |
| 79 | + #{$selector} .mat-h1, |
| 80 | + #{$selector} .mat-headline, |
| 81 | + #{$selector} h1 { |
75 | 82 | @include mat-typography-level-to-styles($config, headline); |
76 | 83 | margin: 0 0 16px; |
77 | 84 | } |
78 | 85 |
|
79 | | - .mat-h2, .mat-title, #{$selector} h2 { |
| 86 | + .mat-h2, |
| 87 | + .mat-title, |
| 88 | + #{$selector} .mat-h2, |
| 89 | + #{$selector} .mat-title, |
| 90 | + #{$selector} h2 { |
80 | 91 | @include mat-typography-level-to-styles($config, title); |
81 | 92 | margin: 0 0 16px; |
82 | 93 | } |
83 | 94 |
|
84 | | - .mat-h3, .mat-subheading-2, #{$selector} h3 { |
| 95 | + .mat-h3, |
| 96 | + .mat-subheading-2, |
| 97 | + #{$selector} .mat-h3, |
| 98 | + #{$selector} .mat-subheading-2, |
| 99 | + #{$selector} h3 { |
85 | 100 | @include mat-typography-level-to-styles($config, subheading-2); |
86 | 101 | margin: 0 0 16px; |
87 | 102 | } |
88 | 103 |
|
89 | | - .mat-h4, .mat-subheading-1, #{$selector} h4 { |
| 104 | + .mat-h4, |
| 105 | + .mat-subheading-1, |
| 106 | + #{$selector} .mat-h4, |
| 107 | + #{$selector} .mat-subheading-1, |
| 108 | + #{$selector} h4 { |
90 | 109 | @include mat-typography-level-to-styles($config, subheading-1); |
91 | 110 | margin: 0 0 16px; |
92 | 111 | } |
93 | 112 |
|
94 | 113 | // Note: the spec doesn't have anything that would correspond to h5 and h6, but we add these for |
95 | 114 | // consistency. The font sizes come from the Chrome user agent styles which have h5 at 0.83em |
96 | 115 | // and h6 at 0.67em. |
97 | | - .mat-h5, #{$selector} h5 { |
| 116 | + .mat-h5, |
| 117 | + #{$selector} .mat-h5, |
| 118 | + #{$selector} h5 { |
98 | 119 | @include mat-typography-font-shorthand( |
99 | 120 | mat-font-size($config, body-1) * 0.83, |
100 | 121 | mat-font-weight($config, body-1), |
|
105 | 126 | margin: 0 0 12px; |
106 | 127 | } |
107 | 128 |
|
108 | | - .mat-h6, #{$selector} h6 { |
| 129 | + .mat-h6, |
| 130 | + #{$selector} .mat-h6, |
| 131 | + #{$selector} h6 { |
109 | 132 | @include mat-typography-font-shorthand( |
110 | 133 | mat-font-size($config, body-1) * 0.67, |
111 | 134 | mat-font-weight($config, body-1), |
|
116 | 139 | margin: 0 0 12px; |
117 | 140 | } |
118 | 141 |
|
119 | | - .mat-body-strong, .mat-body-2 { |
| 142 | + .mat-body-strong, |
| 143 | + .mat-body-2, |
| 144 | + #{$selector} .mat-body-strong, |
| 145 | + #{$selector} .mat-body-2 { |
120 | 146 | @include mat-typography-level-to-styles($config, body-2); |
121 | 147 | } |
122 | 148 |
|
123 | | - .mat-body, .mat-body-1, #{$selector} { |
| 149 | + .mat-body, |
| 150 | + .mat-body-1, |
| 151 | + #{$selector} .mat-body, |
| 152 | + #{$selector} .mat-body-1, |
| 153 | + #{$selector} { |
124 | 154 | @include mat-typography-level-to-styles($config, body-1); |
125 | 155 |
|
126 | 156 | p { |
127 | 157 | margin: 0 0 12px; |
128 | 158 | } |
129 | 159 | } |
130 | 160 |
|
131 | | - .mat-small, .mat-caption { |
| 161 | + .mat-small, |
| 162 | + .mat-caption, |
| 163 | + #{$selector} .mat-small, |
| 164 | + #{$selector} .mat-caption { |
132 | 165 | @include mat-typography-level-to-styles($config, caption); |
133 | 166 | } |
134 | 167 |
|
135 | | - .mat-display-4, #{$selector} .mat-display-4 { |
| 168 | + .mat-display-4, |
| 169 | + #{$selector} .mat-display-4 { |
136 | 170 | @include mat-typography-level-to-styles($config, display-4); |
137 | 171 | margin: 0 0 56px; |
138 | 172 | } |
139 | 173 |
|
140 | | - .mat-display-3, #{$selector} .mat-display-3 { |
| 174 | + .mat-display-3, |
| 175 | + #{$selector} .mat-display-3 { |
141 | 176 | @include mat-typography-level-to-styles($config, display-3); |
142 | 177 | margin: 0 0 64px; |
143 | 178 | } |
144 | 179 |
|
145 | | - .mat-display-2, #{$selector} .mat-display-2 { |
| 180 | + .mat-display-2, |
| 181 | + #{$selector} .mat-display-2 { |
146 | 182 | @include mat-typography-level-to-styles($config, display-2); |
147 | 183 | margin: 0 0 64px; |
148 | 184 | } |
149 | 185 |
|
150 | | - .mat-display-1, #{$selector} .mat-display-1 { |
| 186 | + .mat-display-1, |
| 187 | + #{$selector} .mat-display-1 { |
151 | 188 | @include mat-typography-level-to-styles($config, display-1); |
152 | 189 | margin: 0 0 64px; |
153 | 190 | } |
|
0 commit comments