DT in R - How to set caption color?

Viewed 2566

Is it possible to set color in the caption of a DT table in an html document?

I've tried with

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

but without results.

any idea?

1 Answers

You can do in this way:

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

If you want to mix several styles:

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

Related