GithubHelp home page GithubHelp logo

Comments (1)

dotansimha avatar dotansimha commented on June 4, 2024 1

@omararturo please refer to Angular 2 Component Styles documentation.
I don't think it's an issue with angular2-compilers, because Angular 2 encapsulates each Component's styles by it self, without any chance to override other Component's styles.
It means that every Component has it's own style - and it can effect only the elements that it creates (NOT the Components it uses) - which means that every Angular 2 Component that uses Angular2-Material Component's, can decide only the parent element style (for example md-tab-group which is the parent).

More in depth, Angular 2 changes every CSS stylesheet and append unique identifiers for each style created, and then add the same unique identifier to the matching elements.
Which means that each Component will have it's own identifier, and your md-tab-group will get the styles from the stylesheet of your Component, but it's child elements (such as md-tab) can get it's styles only from the md-tab-group stylesheet.

There are workaround, such as adding the stylesheet outside the Component's context (in the global styles) and then risk overriding other Component's styles.

But you can also use the Angular 2 special selectors, such as /deep/ to override the style of you child Components, and then effect the entire Component's tree, instead of only the first level.

Usage example:

md-tab-group /deep/ div.md-tab-label {
  min-width: 25%  !important;
  max-width: 25%  !important;
}

You can read more in the documentation page I mentioned.

Good luck!

from angular2-meteor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.