从 `bookdown::gitbook` 中删除所有 Table CSS
Remove all Table CSS from `bookdown::gitbook`
我打算 bookdown
为 pixiedust
写一些文档,我觉得对于一个小插图来说可能有点太长了。我喜欢 bookdown::gitbook
的布局,但不幸的是,它带有自己的 table 样式,这对我来说是个问题。由于 pixiedust
完全是关于 table 样式的,因此要显示 pixiedust
使用默认 gitbook 样式完成(或未完成)的内容有点挑战。
我已经尝试在
的指导下清除 CSS
R bookdown gitbook - how to override table style
和
How to change the code padding effect of gitbook?
我没能将 css 代码放在根目录的 css 文件中,并将文件名放在 css
YAML 标记中。我没有成功创建 styles
子目录。而且下面的版本也没用。
---
title: "Sample Book"
output:
bookdown::gitbook:
config:
toc:
collapse: section
scroll_highlight: true
before: null
after: null
theme: null
css: ".book .book-body .page-wrapper .page-inner section.normal table td, .book .book-body .page-wrapper .page-inner section.normal table th { border-left: none; border-right: none; }"
---
```{r, warning = FALSE, message = FALSE, echo = FALSE}
library(pixiedust)
dust(head(mtcars))
```
我尝试过的所有方法都产生了一个 table 看起来像
我想要的是看起来像
的东西
目前,我的根目录是空的,除了上面给出的代码的 index.Rmd
文件。
我正在使用 R 3.2.2 和 bookdown
0.3
可能不是最好的解决方案,但您可以通过在显示 table:
```{r results="asis", echo=FALSE}
cat("
<style>
.book .book-body .page-wrapper .page-inner section.normal table
{
width:auto;
}
.book .book-body .page-wrapper .page-inner section.normal table td,
.book .book-body .page-wrapper .page-inner section.normal table th,
.book .book-body .page-wrapper .page-inner section.normal table tr
{
padding:0;
border:0;
background-color:#fff;
}
</style>
")
```
您可以查找 CSS 重置并在需要时添加更多。
您可以定义一个 css 重置 class。使用您关心的一堆属性,或者如果 Internet Explorer 支持对您不重要,请尝试 new all
attribute。
.reset{
all: initial;
}
或
.reset{
border: initial;
padding: initial;
...
}
然后申请table:
<table class="reset">
我打算 bookdown
为 pixiedust
写一些文档,我觉得对于一个小插图来说可能有点太长了。我喜欢 bookdown::gitbook
的布局,但不幸的是,它带有自己的 table 样式,这对我来说是个问题。由于 pixiedust
完全是关于 table 样式的,因此要显示 pixiedust
使用默认 gitbook 样式完成(或未完成)的内容有点挑战。
我已经尝试在
的指导下清除 CSSR bookdown gitbook - how to override table style
和
How to change the code padding effect of gitbook?
我没能将 css 代码放在根目录的 css 文件中,并将文件名放在 css
YAML 标记中。我没有成功创建 styles
子目录。而且下面的版本也没用。
---
title: "Sample Book"
output:
bookdown::gitbook:
config:
toc:
collapse: section
scroll_highlight: true
before: null
after: null
theme: null
css: ".book .book-body .page-wrapper .page-inner section.normal table td, .book .book-body .page-wrapper .page-inner section.normal table th { border-left: none; border-right: none; }"
---
```{r, warning = FALSE, message = FALSE, echo = FALSE}
library(pixiedust)
dust(head(mtcars))
```
我尝试过的所有方法都产生了一个 table 看起来像
我想要的是看起来像
的东西目前,我的根目录是空的,除了上面给出的代码的 index.Rmd
文件。
我正在使用 R 3.2.2 和 bookdown
0.3
可能不是最好的解决方案,但您可以通过在显示 table:
```{r results="asis", echo=FALSE}
cat("
<style>
.book .book-body .page-wrapper .page-inner section.normal table
{
width:auto;
}
.book .book-body .page-wrapper .page-inner section.normal table td,
.book .book-body .page-wrapper .page-inner section.normal table th,
.book .book-body .page-wrapper .page-inner section.normal table tr
{
padding:0;
border:0;
background-color:#fff;
}
</style>
")
```
您可以查找 CSS 重置并在需要时添加更多。
您可以定义一个 css 重置 class。使用您关心的一堆属性,或者如果 Internet Explorer 支持对您不重要,请尝试 new all
attribute。
.reset{
all: initial;
}
或
.reset{
border: initial;
padding: initial;
...
}
然后申请table:
<table class="reset">