Html 如何在RMarkdown中将浮动图像(环绕文本)与居中标题向右对齐?

Html 如何在RMarkdown中将浮动图像(环绕文本)与居中标题向右对齐?,html,image,alignment,markdown,r-markdown,Html,Image,Alignment,Markdown,R Markdown,到目前为止,这给了我想要的结果 <img align="right" src="images/cobre.png"> 但是我想在图片下面放一个居中的标题。我该怎么做呢?HTML输出可以通过CSS设置样式。样式可以直接包含在文本中,也可以放入单独的CSS样式表中 以下是如何使用内联CSS: ```{=html} <style type="text/css"> .figure { float: right; text-align: center;

到目前为止,这给了我想要的结果

<img align="right" src="images/cobre.png">


但是我想在图片下面放一个居中的标题。我该怎么做呢?

HTML输出可以通过CSS设置样式。样式可以直接包含在文本中,也可以放入单独的CSS样式表中

以下是如何使用内联CSS:

```{=html}
<style type="text/css">
  .figure {
    float: right;
    text-align: center;
  }
</style>
```

``` {r fig.cap = "Insert caption here", echo=FALSE}
knitr::include_graphics("images/cobre.png")
```
`{=html}
.图{
浮动:对;
文本对齐:居中;
}
```
```{r fig.cap=“在此处插入标题”,echo=FALSE}
knitr::include_图形(“images/cobre.png”)
```
与原始HTML相比,使用
knitr::include_graphics
的优势在于
include_graphics
也适用于其他输出格式,如word和pdf(尽管这些格式的图形不会右对齐)