0
votes

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 
---
2
You could add css: mystyles.css and put something like body { text-align:left; }, if that's what you want. However, it is already left aligned by default, so you may mean sth different... - lukeA
I think I was not clear. I meant the whole body to be left aligned. Now the body is centered. - rdatasculptor
Do you care about using the default "boostrap" theme? If not, then you can just do theme: null where you currently have body_placement: left. - hrbrmstr
thanks @hrbrmstr! Nice alternative solution. - rdatasculptor

2 Answers

2
votes

Maybe something like this:

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

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.

enter image description here