View on GitHub

代码(code)

使用 Bootstrap显示内联和多行代码块的文档和示例。

内联代码

<code>包装内联代码段。确保转义HTML尖括号。

For example, <section> should be wrapped as inline.
For example, <code>&lt;section&gt;</code> should be wrapped as inline.

代码块

对多行代码使用 <pre>。再一次,确保在代码中转义任何尖括号,以便正确渲染。您可以选择添加 .pre-scrollable 类,该类将最大高度设置为340px,并提供y轴滚动条。

<p>Sample text here...</p>
<p>And another line of sample text here...</p>
<pre><code>&lt;p&gt;Sample text here...&lt;/p&gt;
&lt;p&gt;And another line of sample text here...&lt;/p&gt;
</code></pre>

变量

使用 <var> 标记指示变量。

y = mx + b
<var>y</var> = <var>m</var><var>x</var> + <var>b</var>

用户输入

使用 <kbd>指示通常通过键盘输入的输入。

To switch directories, type cd followed by the name of the directory.
To edit settings, press ctrl + ,
To switch directories, type <kbd>cd</kbd> followed by the name of the directory.<br>
To edit settings, press <kbd><kbd>ctrl</kbd> + <kbd>,</kbd></kbd>

样本输出

要指示程序的样本输出,请使用<samp> 标记。

This text is meant to be treated as sample output from a computer program.
<samp>This text is meant to be treated as sample output from a computer program.</samp>