Divs and Spans
Divs and spans are Pandoc's fenced syntax for applying classes, IDs, and attributes to blocks and inline content.
Fenced Divs
Basic Syntax
::: {.class-name}
Content inside the div.
:::
Three colons open, three colons close.
Multiple Classes
::: {.class1 .class2}
Content with multiple classes.
:::
With ID
::: {#my-id .my-class}
Content with ID and class.
:::
With Attributes
::: {.my-class key="value" data-info="something"}
Content with attributes.
:::
Nested Divs
Use more colons for outer div:
::: {.outer}
Outer content.
::: {.inner}
Inner content.
:::
More outer content.
:::
Or use different numbers:
::: {.level1}
::: {.level2}
::: {.level3}
Deeply nested.
:::
:::
:::
Spans
Basic Syntax
This is [styled text]{.highlight}.
Multiple Classes
[Important]{.bold .red}
With ID
[Target text]{#target-id}
With Attributes
[Text]{.class key="value"}
Common Div Uses
Custom Styling
::: {.callout-box}
Important information here.
:::
With CSS:
.callout-box {
background: #f0f0f0;
padding: 1em;
border-left: 4px solid #007bff;
}
Columns
::: {.columns}
::: {.column width="50%"}
Left column.
:::
::: {.column width="50%"}
Right column.
:::
:::
Centering
::: {.center}
Centered content.
:::
Hiding Content
::: {.hidden}
This won't appear.
:::
Raw Content Blocks
Insert format-specific content:
HTML
```{=html}
<div class="custom-html">
<p>Raw HTML content.</p>
</div>
```
LaTeX
```{=latex}
\begin{center}
Raw LaTeX content.
\end{center}
```
Typst
```{=typst}
#align(center)[
Raw Typst content.
]
```
Inline Raw Content
arkdown Text with `{=html} line break.
## Layout Divs
### Tabsets
````markdown
::: {.panel-tabset}
## Tab 1
Tab 1 content.
## Tab 2
Tab 2 content.
:::
Columns with Layout
::: {layout-ncol=2}


:::
Complex Layout
::: {layout="[[1,1], [1]]"}
First cell.
Second cell.
Full-width cell.
:::
Conditional Divs
Format-Specific
::: {.content-visible when-format="html"}
HTML-only content.
:::
Hidden for Format
::: {.content-hidden when-format="pdf"}
Hidden in PDF.
:::
Special Divs
Callouts
::: {.callout-note}
Note content.
:::
Cross-Referenceable
::: {#fig-diagram}

Figure caption.
:::
Theorems
::: {#thm-main}
Theorem statement.
:::
Proof
::: {.proof}
Proof content.
:::
Span Uses
Inline Styling
This is [red text]{style="color: red;"}.
Class Application
The [key term]{.term} is defined as...
Small Caps
[Small Caps Text]{.smallcaps}
Underline
[Underlined text]{.underline}
Keyboard Input
Press [Ctrl]{.kbd}+[C]{.kbd} to copy.
Custom CSS classes defined in your stylesheet can be applied via .class on divs/spans. Common attributes: .class, #id, style="...", width, height, data-*.
Format-Specific Considerations
HTML
Full CSS styling support. All classes and attributes render directly.
PDF (LaTeX)
Limited styling. Some classes map to LaTeX commands:
.unnumbered- Removes section numbering.unlisted- Excludes from TOC
Word (DOCX)
Classes can map to Word styles via reference doc.
RevealJS
Special classes:
.fragment- Incremental reveal.notes- Speaker notes.r-fit-text- Auto-fit text