Title

Struct Title 

Source
pub struct Title;
Expand description

The <title> element - document title.

§Purpose

The <title> element defines the title of the document, shown in the browser’s title bar or tab. It is also used by search engines as the page title in search results and is important for SEO and accessibility.

§Content Categories

  • Metadata Content

§Permitted Content Model

  • Text content only (no child elements)

§Common Use Cases

  • Setting the browser tab/window title
  • Providing the page title for search engine results
  • Defining the default bookmark name
  • Displaying the page title when sharing on social media

§Key Attributes

  • Global attributes only (rarely used)

§Example

<head>
  <title>Introduction to HTML - Web Development Tutorial</title>
</head>

§Accessibility

  • The title is announced by screen readers when navigating to a page
  • Should be descriptive and unique for each page
  • Typically 50-60 characters for optimal display in search results

§WHATWG Specification

Trait Implementations§

Source§

impl HtmlElement for Title

Source§

const TAG: &'static str = "title"

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

const VOID: bool = false

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

impl CanContain<Text> for Title

Source§

impl CanContain<Title> for Head

Source§

impl MetadataContent for Title

Auto Trait Implementations§

§

impl Freeze for Title

§

impl RefUnwindSafe for Title

§

impl Send for Title

§

impl Sync for Title

§

impl Unpin for Title

§

impl UnwindSafe for Title

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.