English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Bootstrap Code

Bootstrap allows you to display code in two ways:

  • The first one is the <code> tag. If you want to display code inline, then you should use the <code> tag.

  • The second one is the <pre> tag. If the code needs to be displayed as an independent block element or if the code has multiple lines, then you should use the <pre> tag.

Please ensure that when you use the <pre> and <code> tags, the start and end tags use the unicode variant: < and >.

Let's take a look at the following example:

The example is shown as follows:

More examples

Element/ClassDescriptionExample
<var>Variable assignment: x = ab + yTry It
<kbd>Key提示: CTRL + PTry It
<pre>Multiple lines of codeTry It
<pre>Multiple lines of code with a scrollbarTry It
<samp>Computer program output: Sample outputTry It
<code>Same line code snippet: span, divTry It