我使用Kotlin to Javascript插件和kotlinx.html庫來構建示例應用程序:創建CSS類kotlinx.html DSL
fun main(args: Array<String>) {
window.onload = {
document.body!!.append.div {
a("#", classes = "red") {
+"Link"
}
}
}
}
而且我要畫成「red」 CSS類紅色a
鏈接。
現在我使用unsage
+ raw
做到這一點:
document.head!!.append.style {
unsafe {
raw(".red { background: #f00; }")
}
}
如何創建kotlinx.html DSL CSS類?我沒有找到任何與css DSL相關的文檔。