html - Avoid the margin inside pre tag -


how avoid margin inside pre tag:

<p>some text</p>  <pre>     <code>         code     </code> </pre>  <p>some text</p>  <style> pre {     background-color: rgb(255,247,229);     border: 1px solid red; } </style> 

the current output:

enter image description here

the desired output:

enter image description here

the current solution manually remove indentation in markup, shown below. however, understand, not optimal way.

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

you can try changing default value of white-space <pre> tag pre pre-line.

pre-line sequences of whitespace collapsed. lines broken @ newline characters, @ <br>, , necessary fill line boxes.

read more white-space on mdn.

pre {    background-color: rgb(255, 247, 229);    border: 1px solid red;    white-space: pre-line;  }
<p>some text</p>  <pre>    <code>      code    </code>  </pre>  <p>some text</p>


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -