ixodid
ixodid

Reputation: 2400

Add css to Shiny's HTML tag

I want the text in an HTML tag to be different sizes and red. In this code, the different sizes works, but the red does not.

library(shiny)

ui <- fluidPage(
  HTML("<p style=font-size:28px; font-color:red;>Hello</p><p style=font-size:22px>There</p>"),
)

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

shinyApp(ui, server)

Upvotes: 1

Views: 141

Answers (1)

Mriti Agarwal
Mriti Agarwal

Reputation: 216

You have to use color:red instead of font-color:red and it has to be before the font-size tag. This is the corrected code:

library(shiny)

ui <- fluidPage(
  HTML("<p style=color:red;font-size:28px; >Hello</p><p style=font-size:22px>There</p>"),
)

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

shinyApp(ui, server)

Upvotes: 1

Related Questions