此文档和实例用于展示如何使用 Bootstrap 展示行内代码和多行代码块。
行内代码
用 <code>
包裹行内代码片段。请确保转义 HTML 代码中尖括号。
For example,
<section>
should be wrapped as inline.
For example, <code><section></code> should be wrapped as inline.
代码块
用 <pre>
包裹多行代码。再次注意,请确保转义代码中的尖括号,以便正确展示。你还可以选择性地添加 .pre-scrollable
类,实现垂直滚动,并且设定的最大高度为 340px。
<p>Sample text here...</p>
<p>And another line of sample text here...</p>
<pre><code><p>Sample text here...</p>
<p>And another line of sample text here...</p>
</code></pre>
<var>
变量标签
使用 <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 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>