HTML and CSS Reference
In-Depth Information
If you're getting the actual HTML text repeated in your browser rather than what's
shown in Figure 3.2, make sure that your HTML file has an .html or .htm extension.
This file extension tells your browser that it's an HTML file. The extension is important.
If things are going wrong—if you're getting a blank screen or you're getting some
strange characters—something is wrong with your original file. If you've been using a
word processor to edit your files, try opening your saved HTML file in a plain text edi-
tor. (Again, Notepad will work just fine.) If the text editor can't read the file or if the
result is garbled, you haven't saved the original file in the right format. Go back into
your original editor, and try saving the file as text only again. Then try viewing the file
again in your browser until you get it right.
Text Formatting and HTML
When an HTML page is parsed by a browser, any formatting you might have done by
hand—that is, any extra spaces, tabs, returns, and so on—is ignored. The only thing that
specifies formatting in an HTML page is an HTML tag. If you spend hours carefully
editing a plain text file to have nicely formatted paragraphs and columns of numbers but
don't include any tags, when a web browser loads the page, all the text will flow into one
paragraph. All your work will have been in vain.
There are two exceptions to this rule, a tag called <pre> and a
CSS property. You'll learn about both of them in Lesson 7,
“Formatting Text with HTML and CSS.”
The advantage of having all whitespace (spaces, tabs, returns) ignored is that you can put
your tags wherever you want. The following examples all produce the same output. Try
< h1> If music be the food of love, play on. </h1>
If music be the food of love, play on.
If music be the food of love, play on. </h1>
<h1> If music be the food of love,
play on. </h1 >
Search WWH ::

Custom Search