firmo23
firmo23

Reputation: 8404

Place text in the middle of shinydashboard body

How can you place text exactly in the middle between left and right end of shiny dashboard body at this height?

## app.R ##
library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(disable = T),
  dashboardBody(
    fluidRow(
      column(5,),
      column(4,
             span(h2(strong("Covid-19 Situation Dashboard"), style = 'font-size:30px;color:#6cbabf;')))
    )
  )
)

server <- function(input, output) { }

shinyApp(ui, server)

Upvotes: 1

Views: 506

Answers (1)

YBS
YBS

Reputation: 21297

Use align = "center", as shown below.

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(disable = T),
  dashboardBody(
    fluidRow(
      #column(5,),
      column(12,
             span(h2(strong("Covid-19 Situation Dashboard"), align = "center", style = 'font-size:30px;color:#6cbabf;')))
    )
  )
)

server <- function(input, output) { }

shinyApp(ui, server)

Upvotes: 2

Related Questions