我有一个在R中使用reactable构建的表,并希望添加一个标题,其字体与我在表中使用的字体相同。我知道如何添加标题,但如何更改字体呢?
library(htmlwidgets)
library(reactable)
reactable(head(iris, 10),
style = list(fontFamily = 'Menlo',
fontSize = '14px'),
highlight = TRUE) %>%
htmlwidgets::prependContent(htmltools::tags$h1("This is my Title"))发布于 2020-08-20 21:56:32
您可以在添加标记时设置样式。右键单击列标题显示它们正在使用font-family: Menlo (您请求fontFamily = 'Menlo'的结果),因此这将为您提供相同的字体:
reactable(head(iris, 10),
style = list(fontFamily = 'Menlo',
fontSize = '14px'),
highlight = TRUE) %>%
htmlwidgets::prependContent(htmltools::tags$h1("This is my Title",
style = "font-family: Menlo"))您也可以使用style = "font-family: Menlo; font-size: 14px"来匹配大小。
https://stackoverflow.com/questions/63503366
复制相似问题