Bootstrap | Code

Bootstrap | Code


Hello folks! welcome back to a new edition of our tutorial on Bootstrap. In this tutorial guide, we are going to be discussing about Bootstrap Code.

Bootstrap lets you to display code with two different key ways -

  • The first is the <code> tag. If you are going to be showing code inline, you should use the <code> tag.
  • Second is the <pre> tag. If the code needs to be shown as a standalone block element or it has multiple lines, you should use the <pre> tag.
Make sure that when you use the <pre> and <code> tags, you use the unicode variants for the opening and closing tags - &lt; and &gt;

Example

Following below is a simple example -

<p><code>&lt;header&gt;</code> is wrapped as an inline element.</p>
<p>To display code as a standalone block element use &lt;pre&gt; tag as:</p>

<pre>
   &lt;article&gt;
      &lt;h1&gt;Article Heading&lt;/h1&gt;
   &lt;/article&gt;
</pre>

Output

When the above example is executed, it will produce the following result -

<header> is wrapped as an inline element.

To display code as a standalone block element use <pre> tag as:

         <article>
            <h1>Article Heading</h1>
         </article>


Alright guys! This is where we are going to be rounding up for this tutorial. In our next tutorial guide, we are going to be studying about the Bootstrap Tables.

Feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.