I am trying to add the following div and class to an entire Rmd file in knitr:
<div class="container">
</div>
I have created the container class using css as follows:
.container {
box-shadow: 10px 10px 5px #888888;
width: 70%;
margin: 15em auto 5em;
margin-bottom:-9em;
margin-top:5em;
background: #FFF;
}
.container p {
padding-left: 14%;
padding-right: 10%;
text-indent : 1.25cm;
}
body {
background: #efefef;
}
I would normally use a style.css to add this but for the MWE we'll put it in the main document body of the MW Rmd file at the end. I wrapped the entire document with the div
of class container
and get this output HERE. Notice the header # Hello World
isn't processed as a header? Nothing within the div
tags are processed as html. I can fix this by running knitr without the div
container and then adding it later as seen here: (The HTML and The Rmd).
How can I add the div
tags to the Rmd file directly?
<div class="container">
# Hello World
```{r setup, include=FALSE}
opts_chunk$set(cache=FALSE)
library(knitr); library(knitcitations);
```
<style>
.container {
box-shadow: 10px 10px 5px #888888;
width: 70%;
margin: 15em auto 5em;
margin-bottom:-9em;
margin-top:5em;
background: #FFF;
}
.container p {
padding-left: 14%;
padding-right: 10%;
text-indent : 1.25cm;
}
body {
background: #efefef;
}
</style>
</div>