使用Markdown,如何居中图像及其标题? [英] Using Markdown, how do I center an image and its caption?

查看:5859
本文介绍了使用Markdown,如何居中图像及其标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想结束:

Hello there!

      <image>
      This is an image

Hi!

图片和文字这是图片以页面为中心。如何使用Markdown完成此操作?

Where the image and the text This is an image are centered on the page. How do I accomplish this with Markdown?

编辑:请注意,我要将页面上的图片和文字水平居中。

Note that I'm looking to horizontally center the image and text on the page.

推荐答案

您需要一个具有定义的高度的块容器,与line-height和image相同的值为vertical-align:middle;
它应该工作。

You need a block container with a defined height, same value for line-height and image with vertical-align:middle; It should work.

Hello there !

<div id="container">
    <img />
    This is an image
</div>

Hi !

#container {
    height:100px;
    line-height:100px;
}

#container img {
    vertical-align:middle;
    max-height:100%;
}

这篇关于使用Markdown,如何居中图像及其标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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