我有一张长而窄的图片,想要在GitHub上的README.md文件的右上方展示它。我已经尝试了几种方法来使其右对齐,目前的代码如下:
<p align="right">
<img src="doc/subpagelist.png" />
</p>
尽管这种方式可以将图像对齐到右侧,但它相当无用,因为Markdown文件中所有在图像下方的内容都会显示在图像底部而不是左侧。
有没有一种方法可以使文本绕过图像(而不是消除标题和段落)?
在 GitHub Markdown 中,align="right"
(或 left
)属性可以使用:
<img align="right" src="doc/subpagelist.png">
align="left"
可以正常工作。要再次打破对齐,请使用<br clear="left"/>
(或<br clear="right"/>
)标签:
<img src="/path/to/image.png" align="left" width="200px"/>
some text floating around the image
<br clear="left"/>
A "newline". This text doesn't float anymore, is left-aligned.
这个方法对我来说有效(仅适用于jekyll,不适用于Github markdown): 将以下代码放入您的内容markdown中(我已将其放在第一行以更好地组织)
<style type="text/css">
.image-left {
display: block;
margin-left: auto;
margin-right: auto;
float: right;
}
</style>
以下是您的图像:
[![Proguard](./proguard-snippets.png)](http://www.thiengo.com.br/proguard-android){: .image-left } 在这里输入您的文本...
请注意图像URL旁边的.image-left类。
最终结果在此处: 年度电影jekyll github页面
<user>.github.io/<name>.io
,而不是github.com/<user>/<name>.io
。 - Erwann![Some Title](http://placehold.it/image.jpeg){:style="float: right;margin-right: 7px;margin-top: 7px;"}
# <img align="center" src="https://github.com/YourCompany/YourProject/blob/master/res/Logo.png"> YourProject
,但遗憾的是文本并不真正“居中”。 - Rayclear: both
吗?我使用的图片相当高,它正在渗入到下一个H1部分中。 - Joshua Pinter<br clear="right"/>
。使用style="clear: both"
是不起作用的,原因与style="float: right"
相同:这些style
属性会被删除。 - waldyrious