O'Reilly logo

Learning Shiny by Hernán G. Resnizky

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Styling

Once we have a complete working application, it is time for some styling with CSS. In the following example, just some fonts are changed. It is always good, when possible, to control the styles with CSS. There are some widgets, such as plot outputs that are not so easy to handle as the tags assignment is restricted.

In the following CSS, saved as style.css, some of the texts are styled as follows:

.title {
  font-size: 18px;
  font-weight: bold;
}
h1 {
  font-style: italic;
  font-family: impact;
}

As it was explained in Chapter 8, Shiny and HTML/JavaScript, CSS stylesheets can be included with an includeCSS() statement inside UI.R:

# Starting line shinyUI(fluidPage( #CSS styling includeCSS("PATH_to_CSS_file/style.css"), # Application title titlePanel("Adult ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required