-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(typography): explain how to restore typical specificity within mat-typography class #14604
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,18 @@ descendant native elements. | |
</section> | ||
``` | ||
|
||
When applying the `mat-typography` CSS class, the descendent element rule will by default have | ||
higher specificity than the rules based on the CSS classes above. Therefore, if you would like to | ||
be able to override a `mat-typography` descendent element rule using one of the CSS classes, you'll | ||
need to generate rules for the CSS classes as descendents so they'll have higher specificity than | ||
the descendent element rules like so: | ||
|
||
```scss | ||
.mat-typography { | ||
@include mat-base-typography($typography-config, ".mat-typography-tags-override-classes"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should use single quotes. Also since this is an example, can it use a more concise class name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool beans. If you folks agree this documentation is even worthwhile I'll change it :). |
||
} | ||
``` | ||
|
||
### Customization | ||
Typography customization is an extension of Angular Material's Sass-based theming. Similar to | ||
creating a custom theme, you can create a custom **typography configuration**. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that it's very clear what the issue is from this paragraph. What do you think about something like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for the review. So yeah, clearly it's not worded well if it's not clear what the issue is. Sorry for that. Maybe an example would help.
It would be nice to be able to use .mat-typography for sensible defaults, but allow them to be overridden by the built-in classes so you can use the right semantic tags but still be able to style them according to a standard style guide.
And the reason it doesn't work is that the rules look like this:
instead of this:
I suggested this in an issue but was told that it's by design. So I thought it would be good to let people know how they can still achieve this setup in the guide.
Sorry for the lonnng explanation!