2

I have created a bs4 theme bookdown book. However, I am having no luck changing the global font size to be smaller.

In the _output.yml file, I have added the following bslib options: font_scale and font-size-base, but neither had any effect on the font size.

Attempt #1

bookdown::bs4_book:
  css: bs4_style.css
  theme:
    primary: "#4C566A"
    font_scale: 0.6

Attempt #2

bookdown::bs4_book:
  css: bs4_style.css
  theme:
    primary: "#4C566A"
    font-size-base: "0.5rem"
max
  • 4,141
  • 5
  • 26
  • 55

1 Answers1

2

I also tried to set font_scale, but it seems not working. My solution is to add a CSS fragment in the header of html.

The CSS code is saved into a file css.html with the following content:

<style>
#content {
    font-size: 0.95rem;
}
</style>

Then in .output.yml, the CSS fragment can be added to header by:

bookdown::bs4_book:
  .. other settings ..
  includes:
    in_header: [css.html]
Zuguang Gu
  • 1,301
  • 7
  • 11