How To Remove Margin Introduced In Pre Tag In Bootstrap 4

admin_img Posted By Bajarangi soft , Posted On 10-10-2020

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.

Remove Margin

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.


 

<!DOCTYPE html>
<html>

<head>
    <title>Pre tag usage</title>
</head>

<body>

<!-- Notice the spces inside of the pre tag -->
<pre>BAJARANGI SOFT</pre>
<pre> A Computer  Portal
      For web designers
   </pre>
</body>

</html>

 

Example 2:
Sometimes it happens that you have written some code and give some space or margin inside the pre tag then the output also gives the margin.
Inside pre tag the way you write the code same it will give as an output.
<!DOCTYPE html>
<html>

<head>
    <title>Demo</title>
</head>

<body>
<div class="row">
    <div class="col-md-3">
         <pre>
<p><b>BAJARANGI SOFT</b>
This paragraph is on remove margin
introduced in pre tag in bootstrap 4</p>
</pre>
    </div>
</div>
</body>

</html>

Related Post