R中的DT - 如何设置字幕颜色?

问题描述 投票:1回答:1

是否可以在html文档中的DT表的标题中设置颜色?

我试过了

datatable(table, caption = paste0('<span style="color:#FF8700">Title one<span style="color:#000000">'), rownames=FALSE)

但没有结果。

任何的想法?

r shiny markdown dt
1个回答
2
投票

你可以这样做:

datatable(head(iris), 
          caption = htmltools::tags$caption("hello", style="color:red"),
          rownames=FALSE)

如果你想混合几种风格:

datatable(head(iris), 
          caption = htmltools::tags$caption(htmltools::tags$span("hello", style="color:red;"), htmltools::tags$span("how are you", style="color:blue;")),
          rownames=FALSE)

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.