Meta

Struct Meta 

Source
pub struct Meta;
Expand description

The <meta> element - document metadata.

§Purpose

The <meta> element represents various kinds of metadata that cannot be represented by other HTML meta-related elements (<title>, <base>, <link>, <style>). Used for character encoding, viewport settings, SEO, and social media metadata.

§Content Categories

  • Metadata Content

§Permitted Content Model

  • None (void element)

§Common Use Cases

  • Setting character encoding (charset)
  • Configuring viewport for responsive design
  • Providing page description for search engines
  • Adding Open Graph tags for social media sharing
  • Setting HTTP headers via http-equiv

§Key Attributes

  • charset: Character encoding declaration (e.g., "UTF-8")
  • name: Metadata name (e.g., "viewport", "description", "author")
  • content: Metadata value (used with name or http-equiv)
  • http-equiv: Pragma directive (e.g., "refresh", "content-security-policy")

§Example

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="A comprehensive guide to HTML5">
  <meta property="og:title" content="HTML5 Guide">
  <meta property="og:image" content="https://example.com/image.png">
</head>

§WHATWG Specification

Trait Implementations§

Source§

impl HtmlElement for Meta

Source§

const TAG: &'static str = "meta"

The HTML tag name (e.g., “div”, “span”, “img”).
Source§

const VOID: bool = true

Whether this is a void element (self-closing, no children allowed).
Source§

impl CanContain<Meta> for Head

Source§

impl MetadataContent for Meta

Auto Trait Implementations§

§

impl Freeze for Meta

§

impl RefUnwindSafe for Meta

§

impl Send for Meta

§

impl Sync for Meta

§

impl Unpin for Meta

§

impl UnwindSafe for Meta

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.