5

我正在使用 xaringan 创建一个 html 演示文稿,其中包括一些使用 kable() 生成的表格。不幸的是,这些表很窄,所以我想在 kable_styling 中使用 full_width 选项。此外,我想关闭条纹设计。一个例子:

library(kableExtra)

head(iris) %>% 
knitr::kable('html') %>%
kableExtra::kable_styling(full_width = TRUE, bootstrap_options = "basic")

但是,xaringan 似乎忽略了 kable_styling() 选项。是否有可能实现这些,或者在使用 xaringan 时修改 kable 表的样式?

4

1 回答 1

7

尝试在您的 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;
    }
```

如果您只想更改一个表,则可能需要将表放入容器中并修改上述代码。

让我知道它是否有效。

于 2019-04-01T22:21:35.690 回答