How to apply text alignment in different formats like pdf and html? #13178
Answered
by
mcanouil
luifrancgom
asked this question in
Q&A
-
DescriptionDescriptionI want to apply text alignment in different formats like pdf and html. Minimal reproducible exampleI tried the following: ---
title: "Text alignment"
format:
html:
embed-resources: true
pdf: default
engine: knitr
---
```{css}
#| echo: false
.signature p {
text-align: right;
}
```
::: {.content-visible when-format="pdf"}
\begin{flushright}
Some text align to the right in pdf
\end{flushright}
:::
::: {.signature .content-visible when-format="html"}
Some text align to the right in html
::: I get the expected behavior in pdf but I am not able to do the same in html. I don't know if I am not doing it in a correct way or if there is an alternative way to specify multiple classes in html for Quarto in a div to align the text and that works for multiple formats. Additional information
|
Beta Was this translation helpful? Give feedback.
Answered by
mcanouil
Aug 4, 2025
Replies: 1 comment 1 reply
-
Nest the divs. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
luifrancgom
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nest the divs.
.content-visible when-format="html"
is special. It's not attributes to the content, it's special markup for Quarto.