Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
how to add some styles for some specific components in scoped css?

I'am writing a component (It doesn't matter whether it is developed with Vue or Angular, because they all have the concept of scoped styles. - vue - Angular ). And let us call it foobar.

Because of scoped styles, a .specific style actually is .specific[foobar-component-id-which-is-generated-randomly], so we don't worry styles for foobar will affect other components or elements of other pages unintentionally.

I don't want to give up the benefit.

However, I use many components provieded by a UI libary, for example, Angular-Material's mat-select.

Although mat-select provide a way to add a style class to it, for example, I can add a specific style class to it by <mat-select [panelClass="specific"].

However, write .specific {width: 500px} in foobar.css will not take effect. Because the element generated from mat-select which finally loaded in the page, (I don't know why), dones't have the property foobar-component-id-which-is-generated-randomly.

Is there any solution under the condition of not using global styles and only changing some specific (not all in my writing component) components' styles?

Thanks a lot.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda