Skip to content

Constructing the Stylesheet

bapquad edited this page Feb 20, 2022 · 4 revisions

[Home] > Constructing the Stylesheet

This content we learn how to construct the stylesheet with Element5JS API.

For working with constructed stylesheet. we must to use the style5 package. Let's import it first for using.

import {element5 as $, style5} from '@bapquad/element5'

Rule Object

Next, we creates the style rule object such as body in below example. Rule object allows add CSS stylesheet and add nest selectors.

let body = style5.AddLine("body");
body.AddSelector("#wrapper");

Adding Css Stylesheet

After we have the rule object such as style in below example, we can add some styles with css stylesheet.

style.css({
  "height": "100px", 
  "background": "red"
});