Struct dioxus_html::div

source ·
pub struct div;
Expand description

Build a <div> element.

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

Definition and Usage

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

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

element.

Usage

html!(<div> A header element </div>)
rsx!(div { "A header element" })
LazyNodes::new(|f| f.element(div, &[], &[], &[], None))

References:

Implementations§

Trait Implementations§

Prevent the default action for this element. Read more
The HTML class attribute is used to specify a class for an HTML element. Read more
dangerous_inner_html is Dioxus’s replacement for using innerHTML in the browser DOM. In general, setting HTML from code is risky because it’s easy to inadvertently expose your users to a cross-site scripting (XSS) attack. So, you can set HTML directly from Dioxus, but you have to type out dangerous_inner_html to remind yourself that it’s dangerous

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.