The problem is that whenever you apply margin space as per your margin value it will give you output. But in <pre> tag if you apply it by keeping any space then it will consider as margin. Because pre is acted vice versa, means as you have written inside the pre tag the output will be the same.
Note: The examples will act same with the bootstrap.
Example 1: The approach of the pre tag is basically used if you want to write the code and print it as a normal text.
- Program:
html <!DOCTYPE html> <html> <head> <title>Pre tag usage</title> </head> <body> <!-- Notice the spces inside of the pre tag --> <pre> GeeskforGeeks </pre> <pre> A Computer Science Portal For Geeks </pre> </body> </html>
- Output:
GeeskforGeeks A Computer Science Portal For Geeks
- Program:
HTML <!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <div class="row"> <div class="col-md-3"> <pre> <p><b>GeeksforGeeks</b> This paragraph is on remove margin introduced in pre tag in bootstrap 4</p> </pre> </div> </div> </body> </html>
- Output:
GeeksforGeeks This paragraph is on remove margin introduced in pre tag in bootstrap 4