Joe
Joe

Reputation: 3806

title selector not responding to font-size rule in css for Rmarkdown html report

The font size of my title, "Utilize Css" seems unresponsive to the font-size argument in my css style sheet saved in the same directory. I have experimented with all the other arguments in this css style sheet, and they all update the report as expected, but the font-size argument for the title selector has no impact on the title in the report.

I am using a YAML header like this

---
title: "Utilize Css"
author: "Me"
date: "2019-07-15"
output:
  html_document:
    css: style.css
---

And a style sheet like this

.title {
  font-size: 14px;
  text-align: center;
}

.author, .date {
  font-size: 14px;
  text-align: center;
}

body {
  font-family: Arial;
  font-size: 12pt;
}

h1 {
  font-size: 14pt;
  font-weight: bold
}

As you can see, all font sizes were set by the css style sheet except the title's font size.screenshot

How can I use a css style sheet to control the font size of the title in an html report?

Upvotes: 0

Views: 458

Answers (1)

joshpk
joshpk

Reputation: 769

You should be able to us h1.title in your style.css file to control the title size.

h1.title {
  font-size: 14px;
  text-align: center;
}

.author, .date {
  font-size: 14px;
  text-align: center;
}

body {
  font-family: Arial;
  font-size: 12pt;
}

h1 {
  font-size: 14pt;
  font-weight: bold
}

Upvotes: 1

Related Questions