[英]How to use margin/padding in GitHub README.md?
I'm trying to display several images in GitHub's README.md with a margin of x
px between them.我试图在 GitHub 的 README.md 中显示几个图像,它们之间的边距为
x
px。 But for some reason GitHub seems to strip away the margin-right: 30px
style.但由于某种原因 GitHub 似乎剥离了
margin-right: 30px
样式。
[<img style="margin-right: 30px" src=foo.svg height=30>](https://www.example.com/)
[<img style="margin-right: 30px" src=bar.svg height=30>](https://www.example.com/)
<!-- ...and so on -->
Note: I tried align="left"
here which works fine but breaks on lg
sm
xs
devices.注意:我 在这里尝试
align="left"
,它工作正常,但在lg
sm
xs
设备上中断。
It is not possible to use different types of
styles
in GitHub markdown.GitHub markdown中不能使用不同类型的
styles
。
Github only allows to use of some attributes inside the HTML tag and also removes some attributes from the tag if the user puts them inside the HTML tag. Github 只允许使用 HTML 标签内的一些属性,如果用户将它们放在 HTML 标签内,也会从标签中删除一些属性。
Also, we cannot use CSS in GitHub markdown because it is part of the sanitization process.此外,我们不能在 GitHub markdown 中使用 CSS,因为它是清理过程的一部分。
The HTML is sanitized, aggressively removing things that could harm you and your kin—such as
<script>
tags, inline styles, andclass
orid
attributes.HTML 经过消毒,积极删除可能伤害您和您的家人的东西,例如
<script>
标签、内联 styles 和class
或id
属性。
source: https://github.com/github/markup#github-markup来源: https://github.com/github/markup#github-markup
If we use an HTML block in the markdown file something like如果我们在 markdown 文件中使用 HTML 块,例如
<div style="margin-right: 30px;">
Markdown content goes here.
</div>
Then, When GitHub rendered it, the style attribute was automatically removed and no CSS style was applied.然后,当 GitHub 渲染它时,样式属性被自动删除,并且没有应用 CSS 样式。 It will render it something like
它会使它像
<div>
Markdown content goes here.
</div>
NB: In the case of positioning, the align attribute is the only way that will currently work.
注意:在定位的情况下, align 属性是当前唯一可行的方法。 Despite being deprecated, it's still rendered.
尽管被弃用,它仍然被渲染。
You could use
你可以使用
to make space instead of CSS margin.腾出空间而不是 CSS 边距。
While a bit hacky, you can use <dl>
, <dt>
and <dd>
tags in combination to make indent without any enumeration (unlike <ul>
/ +
/ -
/ *
or <ol>
/ 1. 2. 3.
).虽然有点 hacky,但您可以结合使用
<dl>
、 <dt>
和<dd>
标签来进行缩进而不需要任何枚举(不像<ul>
/ +
/ -
/ *
或<ol>
/ 1. 2. 3.
)。
The lines in preview below are generated by ---
, but it works without those.下面预览中的行由
---
生成,但没有这些行。
See example below:请参见下面的示例:
This is normal text.
---
<dl>
<dd>This gets indented, without enumeration nor dots.</dd>
</dl>
---
<dl>
<dd>
<dl>
<dd>
Multiple levels seems to be possible?
</dd>
</dl>
</dd>
</dl>
---
<dl><dd><dl><dd><dl><dd><dl><dd>
Yes, but syntax gets messy, unless you write it single line :)
</dd></dl></dd></dl></dd></dl></dd></dl>
Check it directly in my GitHub gist here. 直接在我的 GitHub gist 中查看。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.