Latest web development tutorials

Bootstrap Code

Bootstrap allows you to display the code in two ways:

  • The first is the <code> tag. If you want to display inline code, then you should use <code> tag.
  • The second is the tag <pre>. If the code needs to be shown as a separate block element or multiple lines of code, you should use the <pre> tag.

Make sure that when you use the <pre> and <code> tag, the start and end tags use a unicodevariants: & lt; and & gt;.

Let's take a look at the following examples:


<P> <code> & lt ; header & gt; </ code> is surrounded as inline elements. </ P> <P> If you need to put the code appears as a separate block element, use & lt; pre & gt; tag: </ p> <Pre> & lt; article & gt; & lt; h1 & gt; Article Heading & lt; / h1 & gt; & lt; / article & gt; </ Pre>

try it"

Examples show the following picture:


More examples

Element / class description Examples
<Var> Variable assignment: x = a b + y try it
<Kbd> Key Tip: CTRL + P try it
<Pre> Multiple lines of code try it
<Pre class = "pre-scrollable"> Multiple lines of code with a scroll bar try it
<Samp> Computer program output: Sample output try it
<Code> The same line of code fragment: span , div try it