Styles
In resquare, you can use the CSS flexbox approach to define the style. Resquare will use Stretch as the layout engine to calculate the position and the size of div.
If you are not familiar with flexbox, we recommend you to try Flexbox Froggy, which is an interactive game to learn flexbox.
Without Flexbox?
Q: Can I use Resquare without flexbox layout?
A: Well, yes, but you will not benefit from most of the Resquare features. Because one of the pros of using Resquare is that you don't need to calculate any position or size by yourself when rendering a list like UI.
If you still wish to define the position and size manually, you can set the target div position as absolute
.
#
Define styleYou can use the style DSL builder: styleOf
to create a style object.
#
Dimension unitsThe unit supported in resquare is px
and percent
.
px
- slots in inventory,1.px
= slotpercent
- percentage of the parent size,100.percent
= fill parent
#
Style inheritance and overridingStyle object can be overridden to create a new style object. styleOf
DSL allows inheritance attributes from another Style object.