If you declare a raw CSS selector containing parentheses, such as nth-child(even), without the leading colon, website output will be broken (I have no better word to describe this). Omitting the colon on selectors without parens (hover) doesn't lead to breakages.
Very easily reproducible:
kobweb create app
- Replace the
HomeGridCellStyle in Index.kt with the following block.
- Start the dev server and observe the differences in website behavior when adding and removing the colon in
nth-child
val HomeGridCellStyle = CssStyle {
base {
Modifier
.backgroundColor(GridCellColorVar.value())
.boxShadow(blurRadius = 0.6.cssRem, color = GridCellColorVar.value())
.borderRadius(1.cssRem)
}
cssRule("nth-child(even)") {
Modifier.backgroundColor(org.jetbrains.compose.web.css.Color.chartreuse)
}
cssRule(":hover") {
Modifier.backgroundColor(org.jetbrains.compose.web.css.Color.crimson)
}
}
Version: 0.19.0
If you declare a raw CSS selector containing parentheses, such as
nth-child(even), without the leading colon, website output will be broken (I have no better word to describe this). Omitting the colon on selectors without parens (hover) doesn't lead to breakages.Very easily reproducible:
kobweb create appHomeGridCellStyleinIndex.ktwith the following block.nth-childVersion:
0.19.0