增加整个 HTML Rmarkdown 输出的宽度 [英] Increase width of entire HTML Rmarkdown output

查看:88
本文介绍了增加整个 HTML Rmarkdown 输出的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望增加 HTML Rmarkdown 输出的整体宽度.

I am looking to increase the overall width of my HTML Rmarkdown output.

当从 Rmarkdowns 生成 PDF 文档时,可以选择在 Rmd 的 YAML 部分设置边距(例如几何:边距 = .5in).

When producing PDF documents from Rmarkdowns there is an option to set the margin in the YAML section of the Rmd (ex. geometry: margin=.5in).

我正在为 HTML 文档寻找类似的内容.以下链接是我的问题的一个很好的例子:https://rstudio.github.io/DT/扩展.html

I am looking for something similar for HTML docs. The following link is a good example of my issue: https://rstudio.github.io/DT/extensions.html

正如您在该 html 网页上看到的,数据表的左侧和右侧有很多空白.有没有办法减少这个边距空间,从而增加数据表的宽度?

As you can see on that html webpage, there is a lot of white space to the left and right of the datatables. Is there a way to reduce this margin space and thus increase the width of the datatables?

谢谢

推荐答案

将其放在 rmarkdown 文档的顶部(但低于 YAML):

Put this at the top (but below the YAML) of your rmarkdown document:

<style type="text/css">
.main-container {
  max-width: 1800px;
  margin-left: auto;
  margin-right: auto;
}
</style>

不要把它放在一个块中,而是作为纯文本.它应该将内容区域的最大宽度设置为 1800 像素.

Don't put it in a chunk but as plain text. It should set the max-width of the content area to 1800px.

这篇关于增加整个 HTML Rmarkdown 输出的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆