sim*_*bus 7 r-markdown kableextra kable xaringan
我正在使用 xaringan 创建一个 html 演示文稿,其中包括使用 kable() 生成的一些表格。不幸的是,这些表非常窄,所以我想在 kable_styling 中使用 full_width 选项。此外,我想关掉条纹设计。一个例子:
library(kableExtra)
head(iris) %>%
knitr::kable('html') %>%
kableExtra::kable_styling(full_width = TRUE, bootstrap_options = "basic")
Run Code Online (Sandbox Code Playgroud)
但是,xaringan 似乎忽略了 kable_styling() 选项。是否有可能实现这些目标,或者在使用 xaringan 时修改 kable 表的样式?
尝试在 kable 表之前添加以下代码。
```{css, echo=F}
/* Table width = 100% max-width */
.remark-slide table{
width: 100%;
}
/* Change the background color to white for shaded rows (even rows) */
.remark-slide thead, .remark-slide tr:nth-child(2n) {
background-color: white;
}
```
Run Code Online (Sandbox Code Playgroud)
如果您只想更改一张表,则可能需要将该表放入容器中并修改上述代码。
让我知道它是否有效。
| 归档时间: |
|
| 查看次数: |
1575 次 |
| 最近记录: |