Just like HTML, Zebble supports inline styling of elements. Again, the same as HTML, you should aim to use CSS whenever possible, and avoid inline styling as much as possible.
To achieve inline styling in your Markup you have two options:
You can directly set the value of each style property in your markup. For example:
Alternatively you can set the combined value of Style, similar to HTML:
They both run with the same performance, and in fact, result in identical generated C# code in the .zebble-generated.cs file.
You can set the values of If you need to specify the styles in C# then you have two options:You can
Alternatively, you can use the fluent API, which allows you to use extension methods to set multiple styles in one line:
Sometimes you need to set several properties of a view or a stylesheet in code behind. For example:
myView.Style.Margin.Bottom = 10;
myView.Style.Padding = 20;
myView.Style.Font.Size = 15;
myView.Style.Font.Bold = true;