Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor isolated CSS - how do you style a child component based on a parent's class (or pseudo class)?

$
0
0

Using Blazor isolated CSS, how do you style a child component based on a parent's class (or pseudo class)?

Given this HTML:

<ParentComponent><ChildComponent /></ParentComponent>

And this CSS:

ParentComponent { display: block; width: 50px; height: 50px; }ChildComponent { display: block; width: 100%; height: 100%; background: yellow; }

Of course it's trivial to style the child component when you hover over the parent component using normal CSS like this:

ParentComponent:hover ChildComponent { background: blue; }

But I'm trying to achieve something similar using Blazor and isolated CSS.

The problem is that obviously in this scenario the child component has no awareness of its parent, so how do I get around this? I guess I'm looking for the opposite to the ::deep pseudo class.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>