Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Normally, white space is folded together and otherwise ignored. So, new lines and all that become one space and text is formatted like this in the browser like we see here, in a paragraph. Sometimes however, you might want the text to be formatted in a particular way, like in this example here, in my text editor. And the way you accomplish that is with the Pre tag. So, I'll just go ahead and change these p's into pre's. That's the Pre tag. It's a block-level tag and what it does is it displays in the browser exactly how it is in the text editor.
So, it will be monospaced and it will be indented just like this and the blank lines and everything. It will be just as it is there in the text editor and there we have it. You will notice a couple of things. First of all, it is a block-level element and so it will behave like that. It will separate the blocks of text out of as if they were paragraphs. Also, you'll notice, of course, that the text is monospaced and that it's indented exactly how it is in the text editor. You'll notice that inline formatting does work. So, here we have a U tag for underline and here you have the word as underlined in the Browser.
So, that's the Pre tag. It does just what it looks like it does. It pre-formats text exactly how it's formatted in the text editor. It's often used for programming language code or HTML code or something like that to display code in a browser, so that the indenting is preserved. It can also be used for wacky ASCII or poetry, like I have done here.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97255 Viewers
61 Video lessons · 84534 Viewers
71 Video lessons · 68734 Viewers
56 Video lessons · 101220 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.