我一直在研究GitHub中使用的Markdown语法,但除了将图像大小调整为README的宽度。md页面,我不知道如何在它的中心图像。

这可能吗?如果有,我该怎么做?


当前回答

为了扩展答案以支持本地图像,只需将FILE_PATH_PLACEHOLDER替换为图像路径并检查它。

<p align="center">
  <img src="FILE_PATH_PLACEHOLDER">
</p>

其他回答

只要去Readme。Md文件并使用此代码。

<div align="center">
<img src=https://newfastuff.com/wp-content/uploads/2019/05/bW7QXVB.png" >
<p>Perfectly balanced</p>
</div>


<div align= " center " >[你的内容在这里]</div>适合页面中的所有内容,并根据页面的尺寸将其居中对齐。

表的方法

另一种方法是使用表。

<表> < tr > < td valign = "中心" > <span style="margin-bottom: 10px;">一些文本</span> . txt < / td > < td valign = "中心" > < img src = " https://github-readme-stats.vercel.app/api?用户名= hossein13m&show_icons = true&title_color = ffffff&icon_color = 34 abeb&text_color = daf7dc&bg_color = 151515 " / > < / td > < / tr > 表> < /

请记住,这将在GitHub自述文件上工作,但不适用于StackOverflow上的代码片段。

您还可以将图像调整为所需的宽度和高度。例如:

<p align="center">
  <img src="https://anyserver.com/image.png" width="750px" height="300px"/></p>

为图像添加居中标题,只需多一行:

<p align="center">This is a centered caption for the image<p align="center">

幸运的是,这对README都有效。md和GitHub Wiki页面。

这其实很简单。

-> This is centered Text <-

记住这一点,你可以把它应用到img语法中。

->![alt text](/link/to/img)<-

它在GitHub上为我工作

<p align="center">
    <img src="...">
</p>