我正在做一个网站,每月发表文章的问题。这很简单,我认为使用Markdown编辑器(如Stack Overflow中的WMD)将是完美的。
然而,他们确实需要在给定的段落中使图像右对齐的能力。
我看不出在目前的体制下有什么办法能做到这一点——有可能吗?
我正在做一个网站,每月发表文章的问题。这很简单,我认为使用Markdown编辑器(如Stack Overflow中的WMD)将是完美的。
然而,他们确实需要在给定的段落中使图像右对齐的能力。
我看不出在目前的体制下有什么办法能做到这一点——有可能吗?
当前回答
你可以直接使用align属性:
<img align="right" width="100" height="100" src="https://images.unsplash.com/photo-1650620109005-099c2de720f8?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxM3x8fGVufDB8fHx8&auto=format&fit=crop&w=500&q=60">
其他回答
在警告框内,将图像和文本作为单个块中的段落的一部分并排对齐。
<div class="warning" style='background-color:#EDF2F7; color:#1A2067; border-left: solid #718096 4px; border-radius: 4px;'>
<p style='padding:0.7em; margin-left:0.7em; display: inline-block;'>
<img src="typora_images/image-20211028083121348.png" style="zoom:70%; float:right; padding:0.7em"/>
<b>isomorphism</b> → In mathematics, an isomorphism is a structure-preserving mapping between two structures of the same type that can be reversed by an inverse mapping.<br>
</p>
</div>
输出:
如果你用Python实现它,有一个扩展可以让你添加HTML键/值对,以及类/id标签。它的语法是:
{: style="float:right"}
或者,如果嵌入式样式不能让你的船浮起来,
{: .floatright}
使用相应的样式表styles .css:
.floatright {
float: right;
/* etc. */
}
更简洁的方法是将p#给定的img {float: right}放在样式表中,或者放在<head>中并包装在样式标签中。然后,只需使用markdown 。
我喜欢learnvst使用表格的答案,因为它是相当可读的(这是编写Markdown的一个目的)。
然而,在GitBook的Markdown解析器的情况下,除了一个空标题行,我还必须在它下面添加一个分隔行,以使表能够被识别并正确呈现:
| - | - |
|---|---|
| I am text to the left |  |
|  | I am text to the right |
分隔线至少需要包含三个破折号——。
你可以直接使用align属性:
<img align="right" width="100" height="100" src="https://images.unsplash.com/photo-1650620109005-099c2de720f8?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxM3x8fGVufDB8fHx8&auto=format&fit=crop&w=500&q=60">