Skip to main content

css

Macro css 

Source
css!() { /* proc-macro */ }
Expand description

Emits a <style> tag or defines a named local CSS helper.

Supported forms:

  • css! { ... }
  • css!(name, { ... })
use maud::html;
use maud_extensions::{css, js};

fn view() -> maud::Markup {
    css!(responsive_css, {
        media!("(min-width: 48rem)", {
            me { padding: rem!(2); }
        })
    });

    html! {
        article.card {
            "Hello"
            (css! {
                me { color: red; }
            })
            (responsive_css())
            (js! {
                me().class_add("ready");
            })
        }
    }
}