Skip to content Skip to sidebar Skip to footer

Changing The Font Size Of Figure Captions In Rmarkdown Html Output

I would like to make the font size of all figure captions in my R Markdown document smaller. The final output is HTML and I'm working in R Studio. To load the picture, I use the in

Solution 1:

Just add the following CSS to your Rmd document (anywhere below the YAML header):

<style>p.caption {
  font-size: 0.6em;
}
</style>

What are we doing here:

If you mark the caption in your browser and inspect that element (Chrome: right-click -> Inspect) you can see that the caption is actually a HTML paragraph with a class named caption:

<pclass="caption"> ... </p>

With the above CSS code we change the font-size of exactly those elements (and only those) to 60% of the default size.


enter image description here

Post a Comment for "Changing The Font Size Of Figure Captions In Rmarkdown Html Output"