Skip to contents

Adds css elements to target outfile, typically a xaringanthemer css file. The css argument takes a list of CSS classes and definitions (see examples below) and appends CSS rules to outfile.

Usage

style_extra_css(
  css,
  outfile = "xaringan-themer.css",
  append = TRUE,
  heading = "Extra CSS"
)

Arguments

css

A named list of CSS definitions each containing a named list of CSS property-value pairs, i.e. list(".class-id" = list("css-property" = "value"))

outfile

Customized xaringan CSS output file name, default is "xaringan-themer.css"

append

If TRUE output will be appended to outfile; otherwise, it will overwrite the contents of outfile.

heading

Heading added above extra CSS. Use NULL to disable.

css list

The css input must be a named list of css properties and values within a named list of class identifiers, for example list(".class-id" = list("css-property" = "value")).

Examples

style_extra_css(
  outfile = stdout(),
  css = list(
    ".red" = list(color = "red"),
    ".small" = list("font-size" = "90%"),
    ".full-width" = list(
      display = "flex",
      width = "100%",
      flex = "1 1 auto"
    )
  )
)
#> 
#> 
#> /* Extra CSS */
#> .red {
#>   color: red;
#> }
#> .small {
#>   font-size: 90%;
#> }
#> .full-width {
#>   display: flex;
#>   width: 100%;
#>   flex: 1 1 auto;
#> }