Sub

Struct Sub 

Source
pub struct Sub;
Expand description

The <sub> element - subscript.

§Purpose

The <sub> element represents subscript text, which appears half a character below the normal line and is often rendered in a smaller font. Used for mathematical, chemical, or typographical notations.

§Content Categories

  • Flow Content
  • Phrasing Content
  • Palpable Content

§Permitted Content Model

  • Phrasing content

§Common Use Cases

  • Chemical formulas (H₂O)
  • Mathematical subscripts (xᵢ, aₙ)
  • Footnote references
  • Typographic conventions

§Key Attributes

  • Global attributes only

§Example

<p>The chemical formula for water is H<sub>2</sub>O.</p>
<p>The variable x<sub>i</sub> represents the i-th element.</p>
<p>CO<sub>2</sub> emissions have increased.</p>

§WHATWG Specification

Trait Implementations§

Source§

impl HtmlElement for Sub

Source§

const TAG: &'static str = "sub"

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<T: PhrasingContent> CanContain<T> for Sub

Source§

impl CanContain<Text> for Sub

Source§

impl FlowContent for Sub

Source§

impl PalpableContent for Sub

Source§

impl PhrasingContent for Sub

Auto Trait Implementations§

§

impl Freeze for Sub

§

impl RefUnwindSafe for Sub

§

impl Send for Sub

§

impl Sync for Sub

§

impl Unpin for Sub

§

impl UnwindSafe for Sub

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.