Open In App

BootStrap 5 Reboot Code blocks

Last Updated : 30 Nov, 2022
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report

Bootstrap 5 Reboot Code blocks are used to put the code inside of <pre> tag, according to official docs we recommend that you avoid using any angle brackets inside of <pre> tags. This is used to remove the default margin of the HTML pre tag element.

BootStrap5 Reboot Code blocks Class: There is no predefined class to do the Reboot Code Blocks. 

BootStrap5 Reboot Code blocks Tags: The HTML code tag has to use with the Bootstrap CDN link, it removes the extra space.

Syntax:

<pre>
      <code> 
        ... 
      </code>
</pre>

The below examples illustrate the BootStrap5 Reboot Code blocks:

Example 1:  In this example, we will put some C code inside the <pre> and <code> tags without the formatting.

HTML
<!DOCTYPE html>
<html>

<head>
    <link href=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" 
        rel="stylesheet" integrity=
"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
        crossorigin="anonymous">
</head>

<body class="m-3">
    <center>
        <h1 class="text-success">
            GeeksforGeeks
        </h1>
        <strong>
              BootStrap5 Reboot inline code
          </strong>
    </center>
    <code>
        #include>stdio.h>
            int main() {
                printf("Hello Geeks");
            }
    </code>
</body>
</html>

Output:

BootStrap 5 Reboot Code blocks
BootStrap 5 Reboot Code blocks

Example 2: In this example, we will put some C code inside of the <pre> & <code> tag with the formatting by putting them in a <pre> tag, and because of the <pre> tag, it removes the color.

HTML
<!DOCTYPE html>
<html>

<head>
    <link href=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" 
        rel="stylesheet" integrity=
"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
          crossorigin="anonymous">
</head>

<body class="m-3">
    <center>
        <h1 class="text-success">
            GeeksforGeeks
        </h1>
        <strong>
              BootStrap5 Reboot Code blocks
          </strong>
    </center>
    <pre>
        <code>
            #include<stdio.h>
                int main() {
                printf("Hello Geeks");
                }
        </code>
    </pre>
</body>

</html>

Output:

BootStrap 5 Reboot Code blocks

Reference: https://getbootstrap.com/docs/5.1/content/reboot/#code-blocks


Next Article

Similar Reads