How to apply css class to a component element when it's created by router-outlet?

前端 未结 11 1466
南旧
南旧 2020-12-15 15:41

I have DOM that looks something like this:


    
    ...

         


        
11条回答
  •  忘掉有多难
    2020-12-15 15:52

    since router injects the component after the the router-outler element, if we would like to style all injected component with the same set of rules the folowing rule is can be helpful.

    the css "+" operator select the first sibling element of a certain type, while asterisk (*) is used as a wild card to select any 1st sibling of router-outlet

    router-outlet + * {
      // your rules
    }
    

提交回复
热议问题