Search code examples
htmlcsswebtext

It is possible to embed plain text into HTML?


I need to embed a huge text file in plain text which contains a lot of information organized by newlines, tabulations and spaces. This text file does not have any html tags, it's just plain text.

I need to show it embedded into an HTML file, because I don't want to write thousands of tags (<br>, etc...) to reorganize the text, because if I just paste the plain text into a <b> tag into an HTML file, the text is shown as a only paragraph without newlines, spaces and tabulations. I'm not sure how to do this. I can't find any info about that.


Solution

  • Contents in a <pre> tag will make use of new lines, white space, and tabs.

    If you need the letters to line up on top of each other like in a command line, you're wanting a "fixed width" font. You can take a look a the <tt> tag, or you'd have to set the font for that block to a fixed-width font (which would be a different question)