Basic styling

Report a typo

Create a CSS style using kotlinx.css, setting the text color to green and the background color to yellow.

Instructions:

  1. Import the necessary package kotlinx.css.
  2. Declare the function cssStyle() that returns a CssBuilder.
  3. Inside the cssStyle() function, use apply on the CssBuilder object to apply styles:
    • Set the text color (color) to green (Color.green).
    • Set the background color (backgroundColor) to yellow (Color.yellow).
  4. In the main() function, call the cssStyle() function and store the result in the basicStyle variable.
  5. Print the string representation of basicStyle using println.
Reorder lines using drag or arrows. Adjust indentation with left buttons
                return CssBuilder().apply {
              
                val basicStyle = cssStyle()
              
                color = Color.green
              
                import kotlinx.css.*
              
                }
              
                fun main() {
              
                fun cssStyle(): CssBuilder {
              
                }
              
                backgroundColor = Color.yellow
              
                }
              
                println(basicStyle.toString())
              

Create a free account to access the full topic