R knitr markown:设置HTML页面宽度 [英] R knitr markown: Setting HTML page width

查看:385
本文介绍了R knitr markown:设置HTML页面宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 knitr 创建HTML网页。默认设置似乎是800px,但我需要一个较大的页面大小1100px

I am using knitr to create a HTML webpage. The default setting seems to be 800px but I need a larger page size of 1100px

body {
    max-width: 800px;
    margin: auto;
    padding: 1em;
    line-height: 20px ; 
}   

我试过:

library("markdown")
library("knitr")
knit2html("test.Rmd",options = c(width=1100))

但这还是给我较小的页面大小800px

But this still gives me the smaller page size of 800px

如何设置HTML页面宽度的代码?

How can I set the code for the HTML page width?

推荐答案

添加 css 元素到您的文档,例如

Add a css element to your document, e.g.

---
title: "test"

output:
  html_document:
    css: "test.css"
---

然后将新的css信息放在该文件中,例如

and then put your new css information in that file, e.g.

body {
  max-width: 1100px;
  margin: auto;
 padding: 1em;
 line-height: 20px ; 
}   

这篇关于R knitr markown:设置HTML页面宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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