这适用于使用以下命令生成的表kableExtra
这在检查长桌子时很有用。我想知道是否有人知道如何做到这一点huxtable
.
这是一个示例 Rmd 以了解我的意思。我希望在向下滚动时将 huxtable 标题固定在页面顶部,就像在 kable 中一样。
---
output: bookdown::html_document2
---
```{r lib}
library(magrittr)
```
```{r kable}
iris %>%
head(20) %>%
kableExtra::kbl(caption = "a caption") %>%
kableExtra::kable_styling(fixed_thead = TRUE)
```
```{r huxtable}
iris %>%
head(33) %>%
huxtable::hux() %>%
huxtable::set_caption("a caption")
```
相关:是否可以使 huxtable 输出悬停? https://stackoverflow.com/questions/75813617/is-it-possible-to-make-a-huxtable-output-hoverable
简单设定position: sticky
对于每个th
huxtable 表的元素。
---
output: bookdown::html_document2
---
```{r lib}
library(magrittr)
```
```{r huxtable}
iris %>%
head(33) %>%
huxtable::hux() %>%
huxtable::set_caption("a caption")
```
```{=html}
<style>
table.huxtable th {
position: sticky;
top: 0;
background: white;
}
</style>
```
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)