【问题标题】:How to center an image using Showdown如何使用 Showdown 使图像居中
【发布时间】:2017-08-28 02:17:04
【问题描述】:

有没有办法使用 ShowDown 使图像居中。

我正在尝试这样的事情:

## Next line has an image

![image](http://i.imgur.com/wYTCtRu.jpg =50%x50% )

【问题讨论】:

    标签: showdown


    【解决方案1】:

    要在 shodown 中设置特定图像的样式,you can use the title attribute

    问题是“居中”需要一个父元素来“居中”。所以你总是需要添加一个“包装器”。

    要实现这一点,您有几个选择:

    1. 使用HTML and CSS(点击左上角的3条符号关闭选项菜单)

      ## Next line has an image
      
      <div style="text-align: center;"><img src="http://i.imgur.com/wYTCtRu.jpg" width="50%"></div>
      

      ## Next line has an image
      
      <div markdown="1" style="text-align: center;">![image](http://i.imgur.com/wYTCtRu.jpg =50%x50%)</div>
      
    2. 使用the &lt;center&gt; html tag(在 HTML5 中已弃用)

      ## Next line has an image
      
      <center>![image](http://i.imgur.com/wYTCtRu.jpg =50%x50%)</center>
      
    3. wrap the image tag in a &lt;a&gt; tag and style with CSS

      <style>
        a[title="myImageWrapper"] {
        display: block;
        width: 100%;
        text-align: center;
      }
      </style>
      
      ## Next line has an image
      
      [![image](http://i.imgur.com/wYTCtRu.jpg =50%x50%)](# "myImageWrapper")
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-28
      • 2016-04-23
      • 2021-03-25
      • 2020-11-04
      相关资源
      最近更新 更多