Does anyone know how to present this CSS with Comp...
# compose-web
t
Does anyone know how to present this CSS with Compose HTML StyleSheet?
Copy code
.parent:hover .child {}
I see an old thread but I cannot make it works. https://kotlinlang.slack.com/archives/C01F2HV7868/p1637156187139600
c
This would be the preferred approach I guess, but it does not work in this specific case:
Copy code
desc(parent + hover, child) style {
   backgroundColor(Color.firebrick)
}
If you do it manually, it works:
Copy code
"${className(parent)}$hover ${className(child)}" style {
            backgroundColor(Color.aliceblue)
}
with
parent
and
child
defined before the
init
block in the
StyleSheet
it works if one parameter is just a string:
Copy code
val parent by style {
        desc(self + hover, "img") style {
            backgroundColor(Color.aliceblue)
        }
}
okay here is the best solution I could find:
Copy code
desc(className(parent) + hover, className(child)) style {
            backgroundColor(Color.firebrick)
}
t
Thanks @Chrimaeon. They works well for me.
Look like I missed
.
when calling
$parent