<!--
  canonical-url: https://www.avonture.be/blog/quarto-inline-style
  published:     2024-04-13
  This is a static plain-Markdown mirror generated at build time.
  Visit the canonical URL above for the fully rendered page, with images and interactive components.
-->

# Quarto Inline style

> Quickly apply inline CSS styles in Quarto for HTML documents using the []{}  syntax. Highlight text instantly without writing a full CSS class.

---
![Quarto Inline style](/img/v2/quarto.webp)

**TL;DR**

This article shows Quarto's inline CSS span syntax `[text]{style="..."}` for quickly styling a bit of text (color, background, etc.) without defining a CSS class — noting it only renders in HTML output, and is silently ignored in Word or PDF.

Don't want to take the time to create a CSS class and figure out how to integrate it into Quarto to quickly highlight part of your paragraph?

Quarto supports an *inline css style* syntax for producing **HTML documents** (not working for, f.i., pdf or docx). *If you need the content itself, and not just its styling, to differ between formats, see [Quarto conditional display](/blog/quarto-conditional-display).*

> **Syntax:**
>
> You can apply styles to inline text by creating spans using `[]` to surround the text you want to style and `{}` to define the style you want to apply.

So to put a text like *red* in red, the syntax for Quarto is `[red]{style="color: red;"}`. The text enclosed between brackets will get the specified inline CSS style.

```markdown
# Inline style

To draw attention to a specific part of the text, you might want to make it [red]{style="color: red;"} with a [yellow background]{style="background-color: yellow;"}; [like this]{style="color: red; background-color: yellow;"}.
```

This is correctly rendered in HTML:

![html](./images/html.webp)

> [source](https://mine-cetinkaya-rundel.github.io/quarto-tip-a-day/posts/11-spans/).

> **Docker image with Quarto:**
>
> If you don't have yet a Docker image with Quarto, read this article [Running Quarto Markdown in Docker](/blog/docker-quarto).

But just ignored in Word or PDF:

![docx](./images/docx.webp)

![pdf](./images/pdf.webp)
