简体   繁体   English

CSS 去除了 ioslides 中的 Kable 样式

[英]CSS strips Kable Styling in ioslides

I am trying to put together an ioslides presentation with R Markdown.我正在尝试将 ioslides 演示文稿与 R Markdown 放在一起。 To remove the gray gradient at the bottom of the output, I've created a "style.css" file that contains the below and it works great:为了删除输出底部的灰色渐变,我创建了一个包含以下内容的“style.css”文件,效果很好:

slides > slide {
  background: linear-gradient(#ffffff, #ffffff 85%, #ffffff);
  background-color: white;
  }

However, I'm also trying to use kable() and kabel_styling() for my tables and adding the files makes the kable() tables lose their formatting.但是,我也尝试将 kable() 和 kabel_styling() 用于我的表并添加文件会使 kable() 表丢失其格式。

Here is my YAML Header这是我的 YAML 标头

---
title: "Research"
subtitle: "Ben Howell"
author: "Student at School"
date: "`r Sys.Date()`"
output: 
  ioslides_presentation:
    css: style.css
---

and a reprex of my table:和我的桌子的reprex:

x <- c(2, 3, 4, 1, 3)
y <- c(12, 11, 17, 14, 25)

test <- data.frame(x, y)

test %>%
  knitr::kable(booktabs = TRUE) %>%
  kable_styling(bootstrap_options = c("striped", "hover"), font_size = 16,
                position = "center", full_width = FALSE) %>%
  row_spec(0, bold = TRUE, font_size = 20)

I'd really like to be able to make the css file remove the gray gradient while not affecting anything else.我真的很希望能够让 css 文件删除灰色渐变,同时不影响其他任何东西。 I appreciate the help!我感谢您的帮助!

(Also, if anyone knows what other YAML headers work for author/affiliation/etc in ioslides, I'd appreciate that too so I can break up my "author" heading into two. Thanks!) (另外,如果有人知道 ioslides 中还有哪些其他 YAML 标头适用于作者/附属机构/等,我也很感激,这样我就可以将我的“作者”标题分成两个。谢谢!)

When including your own stylesheet, the default bootstrap styles (the default theme) are not applied to your document.包含您自己的样式表时,默认引导程序样式(默认主题)不会应用于您的文档。 And that includes the class .table-striped .这包括类.table-striped You can include the default theme first and then your custom styles:您可以先包含默认主题,然后再包含自定义样式:

---
title: "Research"
subtitle: "Ben Howell"
author: "Student at School"
date: "`r Sys.Date()`"
output: 
  ioslides_presentation:
    css: [!expr 'system.file(package = "rmarkdown", "rmd", "h", "bootstrap", "css", "bootstrap.css")', 'styles.css']
---

Or you copy the content of bootstrap.css to your styles.css and only add your additional styles.或者您将bootstrap.css的内容复制到您的styles.css并仅添加您的其他样式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM