Create an object with a linear gradient

Report a typo

You are given scrambled code snippets in Kotlin that use the kotlinx.css library to create a CssBuilder object with a linear gradient background image. Your task is to rearrange the snippets to create a coherent program that correctly generates the CssBuilder and prints its string representation to the console.

Instructions:

  • Start by importing the necessary modules. You should place the import statements at the beginning of your code.
  • Define a function getCss that returns a CssBuilder object.
  • Inside the getCss function, create a CssBuilder object and apply the necessary styles.
  • Set the backgroundImage to a linear gradient with the appropriate direction and color stops.
  • Finally, define the main function and print the string representation of the CssBuilder returned by the getCss function.
Reorder lines using drag or arrows. Adjust indentation with left buttons
                direction = Direction.revert
              
                backgroundImage = linearGradient {
              
                }
              
                import kotlinx.css.*
              
                import kotlinx.css.properties.linearGradient
              
                colorStop(Color.red, 0.pct)
              
                fun main() {
              
                }
              
                }
              
                println(getCss().toString())
              
                fun getCss(): CssBuilder {
              
                colorStop(Color.yellow, 50.pct)
              
                }
              
                return CssBuilder().apply {
              

Create a free account to access the full topic