WFF

wffweb - Java framework to develop web applications

View sample projects on GitHub

CSS properties are the properties of a style attribute. There are multiple ways to set css properties to a style object, see the below code

//if you initially want to have some css properties
Style style = new Style("text-align:center;background-color:green");

//another way of adding css property
BackgroundColor backgroundColor = new BackgroundColor(CssColorName.BLUE);
style.addCssProperties(backgroundColor);

//again another way of adding css property
style.addCssProperty("align-content", "center");

//there some more methods to add/remove/modify properties
//in a style class those you can find from style object.

//to print the attribute name and value
System.out.println(style.toHtmlString());
the final style object will have this outcome
style="text-align:center;background-color:blue;align-content:center"

If a style object is added to multiple tags, then changing the style object properties will apply to all tags to which it is added.

Next >>



Subscribe on youtube for technical videos