Skip to content

Elements CSS classes

Sergey Mashkov edited this page Jul 3, 2015 · 1 revision

CSS classes

One of the most frequently used element attributes is the element style classes. So this is why most element builder functions has optional classes argument that is a space-separated list of classes.

div(classes = "container left tree") {
}

However you also can modify classes inside content lambda

div {
    classes = setOf("container", "left", "tree")
    classes += "siteHeader"
}

🔴 Notice In streaming mode you can't modify element attributes (including classes list) after it was completed or another element started, or text content has been added because tag start was already written to the stream