Function sauron::prelude::styles [−][src]
pub fn styles<V, MSG, P>(
pairs: P
) -> Attribute<&'static str, &'static str, AttributeValue<MSG>> where
V: Into<Value> + Clone,
P: AsRef<[(&'static str, V)]>,
Expand description
A helper function which creates a style attribute by assembling the tuples into a string for the style value.
Example
use sauron::prelude::*;
let html:Node<()> = div(vec![styles([("display", "flex"), ("flex-direction", "row")])], vec![]);
is the same way of writing
use sauron::prelude::*;
let html: Node<()> = div(vec![style!{"display":"flex","flex-direction":"row"}],vec![]);