Skip to main content

image

Function image 

Source
pub fn image(src: impl AsRef<str>, alt: impl AsRef<str>) -> Element
Expand description

An image with its src and alt: <img src="…" alt="…">.

alt is required rather than optional. An image without an alternative text is the single most common accessibility defect in generated HTML. Requiring it here is cheaper than linting for it later (though crate::accessibility::audit does lint for it). Pass "" deliberately for a decorative image.