繁体   English   中英

Kramdown:我如何设置图像的位置?

[英]Kramdown: How can I set the location of the image?

Kramdown语法参考所述 ,我们可以设置图像的高度和宽度大小,如下所示:

Here is an inline ![smiley](smiley.png){:height="36px" width="36px"}.

但是如何设置图像的位置,比如设置align=center

align=center已弃用。 现在你最好使用CSS。

为了实现这一点,您需要将图像放在html块元素中 您的代码可以是:

<div class="img_container">
![Me]({{site.baseurl}}/img/me.jpg){: height="36px" width="36px"}
</div>

在你的CSS中,添加:

.img_container{
  text-align: center;
}

并且,为了指示kramdown解析块html元素,在_config.yml中,添加:

kramdown:
  parse_block_html: true

您的图像现在以其父块为中心。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM