【发布时间】:2019-02-06 06:56:55
【问题描述】:
我想创建一个 html 文档,其中包含居中的传单小部件。
---
title: "Exemple"
author: "Antoine Bichat"
date: "31/08/2018"
output: html_document
---
```{r leaflet, fig.align="center"}
library(leaflet)
leaflet() %>%
addTiles() %>%
addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
```
fig.align="center" 的第一个想法不起作用。
我找到了这个question,并根据我的情况对其进行了调整:
<style>
/* resize the widget container */
.leaflet {
width: 80% !important;
}
/* center the widget */
div.leaflet-control-container {
margin: auto !important;
}
</style>
但如果我不想拥有 100% 的 out.width(我也不想这样做),那就行不通了。
也许我做错了......
实际上我更喜欢 100% R/Rmarkdown 解决方案,但我对一切都持开放态度:)
【问题讨论】:
标签: html css r leaflet r-markdown