pub struct Pre;Expand description
The <pre> element - preformatted text.
§Purpose
The <pre> element represents preformatted text where whitespace (spaces, tabs,
line breaks) is preserved exactly as written in the HTML. Text is typically
displayed in a monospace font.
§Content Categories
- Flow Content
- Palpable Content
§Permitted Content Model
- Phrasing content
§Common Use Cases
- Displaying code snippets (often with
<code>) - ASCII art or text diagrams
- Preserving formatting of plain text
- Command-line output or logs
- Poetry or text where line breaks matter
§Key Attributes
- Global attributes only
§Example
<pre><code>function hello() {
console.log("Hello, World!");
}</code></pre>
<pre>
/\_/\
( o.o )
> ^ <
</pre>§WHATWG Specification
Trait Implementations§
Source§impl HtmlElement for Pre
impl HtmlElement for Pre
impl<T: PhrasingContent> CanContain<T> for Pre
impl CanContain<Text> for Pre
impl FlowContent for Pre
impl PalpableContent for Pre
Auto Trait Implementations§
impl Freeze for Pre
impl RefUnwindSafe for Pre
impl Send for Pre
impl Sync for Pre
impl Unpin for Pre
impl UnwindSafe for Pre
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more