dioxus_html::elements

Module h2

Source
Expand description

Build a <h2> element.

§About

  • The HTML <h2> element is found within the <body> tag.
  • Headings can range from <h1> to <h6>.
  • The most important heading is <h1> and the least important heading is <h6>.
  • The <h2> heading is the second heading in the document.
  • The <h2> heading is usually a large bolded font.

§Usage in rsx

rsx! {
    // Elements are followed by braces that surround any attributes and children for that element
    h2 {
        // Add any attributes first
        class: "my-class",
        "custom-attribute-name": "value",
        // Then add any attributes you are spreading into this element
        ..attributes,
        // Then add any children elements, components, text nodes, or raw expressions
        div {}
        ChildComponent {}
        "child text"
        {raw_expression}
    }
};

Constants§