Header font color with kable

Using kable () to render a simple table gives what appears to be the default color font for the table header in the resulting html file. Is there any way to control font color, size, etc. Tables (or picture)?

--- title: "test" output: html_document: theme: cosmo --- ```{r} library(knitr) tab.1 = table(mtcars$cyl, mtcars$vs) kable(tab.1, caption="Table 1: Caption Font Color") ``` 
+6
source share
2 answers

Yeah! Customizing your CSS stylesheet does the trick.

  caption { color: red; font-weight: bold; font-size: 1.0em; } 
+5
source

Adding to Ani's answer: if you don't want to write the CSS stylesheet separately, you can simply add another piece after YAML:

 '''{r results="asis"} cat(" <style> caption { color: red; font-weight: bold; font-size: 1.0em; } </style> ") ''' 
0
source

Source: https://habr.com/ru/post/1239101/


All Articles