我使用該flextable包凍結 HTML 報告的第一行和第一列。感謝 CSS 注釋,David Gohel 最近在flextable開發版本 ( ) 中添加了這個選項。0.8.3.13但是,我希望標題單元格具有白色背景。我不知道 CSS 語言。任何人都可以幫助我只擁有白色背景的凍結標題單元格嗎?
library(flextable)
dat <- lapply(1:30, function(x) rnorm(n = 50)) %>%
setNames(paste0("colname", 1:30)) %>%
as.data.frame()
ft_1 <- flextable(dat)
ft_1 <- set_table_properties(ft_1,
opts_html = list(
extra_css = ".tabwid tbody tr > :first-child {position: sticky;z-index: 1;left: 0;background: #ddd;}",
scroll = list(height="500px")))
ft_1
uj5u.com熱心網友回復:
只需.tabwid th {background-color: white; z-index: 2;}在. extra_css_set_table_properties
---
title: "Untitled"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(flextable)
library(magrittr)
dat <- lapply(1:30, function(x) rnorm(n = 50)) %>%
setNames(paste0("colname", 1:30)) %>%
as.data.frame()
ft_1 <- flextable(dat)
ft_1 <- set_table_properties(ft_1,
opts_html = list(
extra_css = ".tabwid tbody tr > :first-child {position: sticky;z-index: 1;left: 0;background: #ddd;} .tabwid th {background-color: white; z-index: 2;}",
scroll = list(height="500px")))
ft_1
```
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/521604.html
標籤:htmlcssrr-降价
上一篇:懸停時傾斜效果錯誤
下一篇:選擇該影像后將輸入檔案替換為影像
