Taco
Taco

Reputation: 472

blazor CSS isolation: class as parameter to child

How can I get css isolation to work when the class is added as an argument to child component? In the code below I would expect the child component to be blue, however, this is not happening.

Parent.razor

<div class="firstLayer">
  <Child Class="secondLayer"/>
</div>

Child.razor

<div class="@Class">
  Whaterver
</div>

@code {
   [Parameter] public string Class {get;set}
}

Parent.razor.css

::deep firstLayer secondLayer{
  color: blue;
}

Upvotes: 0

Views: 644

Answers (1)

Nicola Biada
Nicola Biada

Reputation: 2800

I think the deep should be on the second level, like:
firstLayer ::deep secondLayer

or use the CSS on the child.

Upvotes: 1

Related Questions