question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Instructions for overriding component styles through link tag in index.html

See original GitHub issue

Bug, feature request, or proposal:

Documentation Update:

Currently ViewEncapsulation in Material components makes things extremely hard to style without using ::shadow or /deep/ combinators (both of which are currently being deprecated).

We need to indicate to users that they can override component styles using a global CSS file, specified in the link tag of their index.html

Otherwise the components appear too rigid for actual use.

What is the expected behavior?

Documentation indicates easy way to customize styles for Materials components (e.g. link color on a card).

What is the current behavior?

No such documentation exists. Components appear excessively rigid/restrictive, as if you are locked in to specific styles, colors, etc.

What are the steps to reproduce?

Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd

Is there anything else we should know?

Referred here by Martin.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
willshowellcommented, May 26, 2017

@Snesi not necessarily better, but you can remove your !importants by increasing specificity of your styles

.mat-slider.mat-slider-thumb-label-showing
.mat-slider-thumb-container
.mat-slider-thumb-label {
  opacity: 1;
  right: -30px;
  top: -55px;
  width: 75px;
  height: 30px;
  border-radius: 10px;
  background-color: teal;
  transform: scale(1) rotate(0);
}
2reactions
jelbourncommented, Sep 26, 2016

@gopherkhan FYI, only a handful of the component currently have ViewEncapsulation turned on (tabs, progress, tooltip). What’s likely getting in your way is the ViewEncapsulation in your own components. Here’s an example of a component defining styles that affect other components by turning off ViewEncapsulation.

At this point, we don’t want to encourage overriding of any styles in Material; because we’re still in alpha, our css classes and DOM structure will change. Once things are more stable, we plan on providing an API of classes that you’re able to style.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding the encapsulated CSS of external component
To override component styles, we can then do the following: ... syntax ::ng-deep is used to override outside css class or tags without...
Read more >
How to Override CSS Styles - W3docs
How CSS overriding works, what is the cascading order and inheritance, what are the priorities and some tricks to override them.
Read more >
Overriding CSS properties of third-party components in Angular
You can override a third-party component's CSS properties either at an enclosing component or global level. Unless you want to affect all the ......
Read more >
The External Resource Link element - HTML - MDN Web Docs
This text will be red as defined in the external stylesheet. The style attribute can override it, though.
Read more >
How to Edit, Customize, and Override Bootstrap CSS to Suit ...
Simply add the following line of code into the <head> section of your index.html file: <link rel="stylesheet" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found