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 ...

Get Learning Shiny now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.