6.1 How to include CSS?
- Three methods to include CSS in a web page:
- External
- Points to an external file.
- It’s the recommended way, due to being easier to maintain.
- HTML way:
<link rel="stylesheet" href="style.css"/>
- Shiny way
tags$link(rel = "stylesheet", type="text/css", href="www/style.css")
- Internal
- Insert
style
tag in<head>
. - Hard to maintain.
- Shiny way:
tags$head(tags$style("p {color: red;}"))
- Insert
- Inline
- Insert style at tag level.
- Hard to maintain.
- Shiny way:
p(style = "color:red;", "Red text")
- External