我相信我可能忽略了一些显而易见的东西,但我想用自定义的css样式来设计我的表格和 kable
。
你可以在这里找到我 RMD
和 CSS
文件的要点。
我的目标是利用我在这里找到的表格CSS示例。
当我运行报告时,我的表格看起来像这样:
但是根据上面的CSS示例,它应该看起来像下面的图片。
我的问题是:我错过了什么,或者这种程度的样式化对于 RMarkdown
不可能实现。
以下是我的RMD
文件:
---
title: "Test Table CSS"
output:
html_document:
theme: NULL
style: flat-table.css
---
I want to be able to style my tables with CSS. From the looks of it, I should be able to do that
through the use of `CSS` and `knitr:kable`.
```{r setup, echo=FALSE}
data(mtcars)
mt_head = head(mtcars[, 1:5])
```
I want to be able to style my table just like one found [here](http://codepen.io/njessen/pen/naLCv)
```{r echo=FALSE, results='asis'}
library(knitr)
kable(mt_head, "html", table.attr='class="flat-table"')
```