How to align left html_document rendered by rmarkd

2019-09-12 07:55发布

问题:

Since I am not familiar with css I was wondering if there is a simple way to "tell" my rmarkdown page to left align when rendering an HTML-page?

Something like this:

---
title: "My html-page"
output:
 html_document:
  body_placement: left 
---

回答1:

Maybe something like this:

---
title: "My html-page"
output: html_document
---
<style>
body {
    position: absolute;
    left: 0px;}
</style>


回答2:

If you'd actually like some basic styles (i.e. not my theme:null suggestion), grab Skeleton and put normalize.css & skeleton.css in the same directory as your Rmd file. Then you can do:

---
title: "Title"
output:
  html_document:
    theme: null
    css: 
      - normalize.css
      - skeleton.css
    keep_md: true
  md_document:
    variant: markdown_github
---

One

Two

```{r}
print("three")
```

which will result in:

You can add a third - my.css if you want to customize it a bit more.