Macro sauron::style

source ·
style!() { /* proc-macro */ }
Expand description

build a style attribute

§Example:

use sauron::style;
use sauron::html::units::{px, percent};
use sauron::html::attributes::{Attribute,attr};

let s1: Attribute<()> = style! {
    background_color: "red",
    border: (px(1), "solid", "green"),
    width: percent(100),
};
let expected: Attribute<()> = attr("style","background-color:red;border:1px solid green;width:100%;");
assert_eq!(expected.render_to_string(), s1.render_to_string());