user374343
user374343

Reputation:

Formatting to a page html

The text in my source code is formatted properly, but when it shows up in the browser all the formatting disappears. Is there a tag I could add to the paragraph tag to make the text properly format?

Upvotes: 1

Views: 114

Answers (3)

desau
desau

Reputation: 3021

<div style="white-space:pre">
    hereIsSomeSourceCode();
    if (blah == 3)
       doSomething();
</div>

Upvotes: 2

Joey C.
Joey C.

Reputation: 2377

you could use the <pre> and </pre> tags to preserve formatting instead of the <p> tag

Upvotes: 3

Christian Hayter
Christian Hayter

Reputation: 31071

The <pre> tag sounds like what you need.

Upvotes: 2

Related Questions