macro_rules! styles { ($this:ident, $($rest:tt)*) => { ... }; }
Expand description
A convenient shorthand for multiple .style(...)
calls.
Instead of writing this…
html!("div", {
.style("display", "flex")
.style("color", "red")
.style("opacity", "0")
})
…you can instead write this:
html!("div", {
.styles! {
display: "flex",
color: "red",
opacity: "0",
}
})
You can also use string literals as keys:
html!("div", {
.styles! {
color: "red",
"background-color": "green",
}
})