Function styles

Source
pub fn styles<MSG>(
    pairs: impl IntoIterator<Item = (impl Into<Cow<'static, str>>, impl Into<Value>)>,
) -> Attribute<MSG>
Expand description

A helper function which creates a style attribute by assembling the tuples into a string for the style value.

ยงExample

use sauron::{*, html::attributes::styles};

let html:Node<()> = div(vec![styles([("display", "flex"), ("flex-direction", "row")])], vec![]);

is the same way of writing

use sauron::*;
use sauron::html::attributes::styles;

let html: Node<()> = div(vec![style!{"display":"flex","flex-direction":"row"}],vec![]);