Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
In XHTML and HTML Essential Training, Bill Weinman helps designers and coders understand XHTML and HTML. In the process, Bill covers document structure, block and inline-level tags, floating images, controlling white space, phrase and font markup, and tables and frames. He even provides a good introduction to CSS. Bill offers step-by-step guidance for building a complete working web site. Exercise files accompany the course.
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.
Find answers to the most frequently asked questions about XHTML and HTML Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
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.