dioxus_html::elements

Module div

Source
Expand description

Build a <div> element.

Part of the HTML namespace. Only works in HTML-compatible renderers

§Definition and Usage

  • The <div> tag defines a division or a section in an HTML document.
  • The <div> tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript.
  • The <div> tag is easily styled by using the class or id attribute.
  • Any sort of content can be put inside the <div> tag!

Note: By default, browsers always place a line break before and after the

element.

§References:

§Usage in rsx

rsx! {
    // Elements are followed by braces that surround any attributes and children for that element
    div {
        // 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§