2 answers
The pre tag is used to create preformatted text. The text inside this tag will preserve both spaces and line breaks. To add space using the tag, you can add the style attribute and set the value to “margin:10px”.
codelikepro
· 19 Aug 2022
Report
Was this answer helpful?
Thanks for the feedback.
Sign up free to save answers and ask your own doubts
Inside <pre>, simply type the spaces (or tabs) you want; the browser keeps them exactly.
Normally HTML collapses several spaces into one. The <pre> (preformatted text) tag displays text in a monospace font and preserves all spaces and line breaks:
<pre>
Name Marks
Asha 85
Ravi 92
</pre>Here the extra spaces between the columns appear on the page as typed. The CSS margin property only adds space around the whole pre block, not between words inside it. The same effect can be given to any element with CSS white-space: pre;.
Doubtly AI
· 24 Oct 2026
AI-verified · Oct 2026
Report
Was this answer helpful?
Thanks for the feedback.
Sign up free to save answers and ask your own doubts
Your answer
Log in or create a free account to answer this question.