Yonatan Lazar Yonatan Lazar - 1 year ago 94
CSS Question

Override rmarkdown theme in order to change html page width

I'm trying to widen the output of rmarkdown to html. I've been trying this solution with no success (although I'm using the cerulean theme, that should be responsive according to comments). Also tried adding a

css
element as described here - no effect.

How can I make this work?

Answer Source

Option 1: (may not be compatible with all browsers!)

Try this script:

<script>
  $(document).ready(function () {
      $('.main-container').css('max-width','1200px');
  });
</script>

Option 2:

Add these style definitions directly to your RMarkdown document:

<style>
  .main-container {
    max-width: 1200px !important;
  }
</style>

Both work for me.