【发布时间】:2021-04-26 17:26:06
【问题描述】:
我正在尝试在 Rmarkdown html 输出中显示一个大图像,而不自动调整它的大小。为此,我想将图像放在可以沿 x 轴和 y 轴滚动的 div 元素(比图像本身小)中。
这是我迄今为止尝试过的:
---
title: "test"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
<style>
.container {
overflow: scroll !important;
white-space: nowrap;
max-width: 300px;
max-height: 300px;
}
</style>
<div class="container">
<img src="https://images.hdqwalls.com/wallpapers/talking-to-the-moon-ym.jpg" width="2000px"/>
</div>
我想要的是能够以原始大小显示图像,并沿两个轴滚动元素。
编辑
这是我正在寻找的插图:
【问题讨论】:
-
你可能想看看JQuery函数here。图像应“以其原始大小显示,沿两个轴具有可滚动元素”。
-
感谢您的参考,但这并不是我想要的。
-
如果我正确理解您的问题,也许您只需要在
<style>中添加img {max-width: 1000%;}。 -
@RadovanMiletić 似乎不起作用。没有任何变化。
标签: html css r-markdown