TarJae
TarJae

Reputation: 78917

r shiny call css file

The example is from Box and input inline in Shiny, but only for some inputs. I would like to create a css file. How looks a css file of this piece of code?

    tags$head(
      tags$style(type="text/css", ".inline label{ display: table-cell; text-align: left; vertical-align: middle; } 
                 .inline .form-group{display: table-row;}")
      )

and is this reference correct?

  tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "mycss.css")

),

Thanks!

Upvotes: 1

Views: 517

Answers (1)

Stéphane Laurent
Stéphane Laurent

Reputation: 84519

The CSS file mycss.css would be

.inline label {
  display: table-cell; 
  text-align: left; 
  vertical-align: middle;
} 
.inline .form-group { 
  display: table-row;
}

To include it in the app, put it in the www subfolder of the app, and write the following code in the UI:

tags$head(
  tags$link(rel = "stylesheet", href = "mycss.css")
)

Alternatively, you can use includeCSS. This doesn't require to put the CSS file in the www subfolder. See ?includeCSS for more info.

Upvotes: 2

Related Questions