1

I fail to style the text of a PrimeNG TabView.

Here's the Stackblitz showing the problem.

What am I missing?

Antikhippe
  • 6,316
  • 2
  • 28
  • 43
Horse Badorties
  • 308
  • 2
  • 10

1 Answers1

1

One way to solve your problem is to override PrimeNG class concerning tabview title : ui-tabview-title.

So something like

.ui-tabview-title {
  color: red;
}

should do the trick. Be sure to call that CSS after PrimeNG one.

Edit

You can apply CSS on first tab header with :first-child property :

ul.ui-tabview-nav li:first-child span {
  color: red;
}

See working StackBlitz.

Antikhippe
  • 6,316
  • 2
  • 28
  • 43
  • Thanks for your answer. Not sure I get what you mean by "call that CSS after PrimeNG one" though. Putting it into app.component.css does not change anything. And wouldn't overriding the class make all three tab captions red? I wanted to have it for the first tab only. – Horse Badorties Dec 02 '18 at 19:03
  • I forked your StackBlitz to give more details. – Antikhippe Dec 02 '18 at 20:44
  • I've accepted your answer since it's at least a workaround, thanks. Although I'm not happy to "pollute" my app-global style.css with component-specific styles and if I'd happen to have another tab pane in another component that would pick up that style as well. Could you imaging a solution isolated to that very component? – Horse Badorties Dec 03 '18 at 07:28
  • I edited the StackBlitz. Add `encapsulation: ViewEncapsulation.None` in your component. ;) – Antikhippe Dec 03 '18 at 07:44