How to include external css file of a shiny app into flexdashboard

How can I include a external css of a shiny app into the flexdashboard. I have tried putting css file in the YAML header but that didn't work

The style.css is inside www directory
style.css

p{
  
  font-size:100px
}

dashboard.rmd

---
title: 'Dashboard Like a Boss'
output: 
  flexdashboard::flex_dashboard:
    vertical_layout: scroll
    orientation: rows
    runtime: shiny
    css: style.css
---

```{r}
ui <- fluidPage(
  tags$head(tags$link(rel = "stylesheet", href = "style.css")),
  tags$p("Hello, world!")
)

server <- function(input, output, session) {
}
shinyApp(ui, server)

In the dashboard, the styling doesn't work, but when the shiny app is run in a separate file (e.g., app.R), the styling works.

1 Like

Begin by creating an external CSS file that contains the custom styles you want to apply to your flexdashboard. Save this file with a ".css" extension (e.g., "styles.css").

I have already created an external .css file and put into a www directory

1 Like

Already, I've made an external.css file and placed it in the www directory.

1 Like

I didn't understand.

One way I solved this issue was to put css style into a variable and then put it into the head tag

1 Like