How to add striping to table in revealjs quarto presentation #7356
Replies: 2 comments 5 replies
-
I don't think we document this. We document that syntax for markdown tables, and the following works:
(If the caption is empty after applying classes, the table is emitted without a caption.) However, what you want is to add classes to a computational table. That is not so easy right now with Quarto, at least off the top of my head. I think your best approach is to mimic the markdown table output in your R code cell. Thankfully, kable helps you with that:
For this kind of advanced styling, it's helpful to learn your way around the |
Beta Was this translation helpful? Give feedback.
-
I tried both the suggestions above and neither seemed to changed anything in my presentation. Specifically: ## Attempt 2 following quarto docs
| hello | world |
|-------|-------|
| 1 | 2 |
: {.striped .hover} and ```{r}
#| echo: false
knitr::kable(df, caption="{.striped .hover}")
``` both looked identical with and without the part about In the end, I ended up using ```{r}
#| echo: false
knitr::kable(df) |>
kableExtra::kable_classic(c("striped", "hover"),full_width = F)
``` |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I would like to add the classes
.striped
and.hover
to a table that I am calculating using R in a quarto revealjs presentation, but I can't figure out how to do it. The default table style for presentations isn't particularly attractive, so I would like to spruce it up a bit, but I have tried several things and nothing seems to make a difference. For example, I tried the following document to get striping:Both tables look the same, though the second version clearly cannot handle the caption correctly (and I don't want a caption anyway). Looking at the output HTML, I see the following on the first version of the table:
So it is associating the classes with the division, but perhaps these aren't the right classes for revealjs or perhaps these associations are in the wrong place in the document.
If someone can help me fix this, I would appreciate it.
Beta Was this translation helpful? Give feedback.
All reactions