tag I have a problem with text alignment "alignment" inside a paragraph...">

HTML align text alignment with the <pre class = "prettyprint-override"> tag

I have a problem with text alignment "alignment" inside a paragraph with a format and fixed width, because I want the paragraph text in HTML to look completely justified (for example, this will happen with an MS Word file). However, this does not happen. What do I need to change to achieve it?

     <pre style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: medium; width: 500px; text-align: justify;"> 

I have a problem with the text-align "justify" inside a paragraph with format and fixed width, because I want the paragraph text in HTML to appear totally justified (like it would happen with a MS Word file). However, this does not happen. What I need to modify to achieve it?

        </pre>

EDIT: if replacing a tag <pre>with a tag <p>, my code is working correctly. Can someone explain to me why? Maybe I am using the wrong use of the tag <pre>.

+5
source share
3 answers

<pre>, white-space: normal; , , , , <pre>.

- -

<pre> <div> . <pre> .

+10
  pre {
    text-align: left;
    white-space: pre-line;
  }
+7

Use tags:

<pre><code>
Your text
Your text
</code></pre>

Remove all spaces preceding your text, all indents.

0
source

All Articles