Thursday, 5 February 2015

TEXT FORMATTING AND HTML FIGURE 3.2


the sample HTML FILE.
Next, go back to your browser. Locate and chose a menu item or button called reload (for nets cape users) or refresh (for internet explorer users). The browser will read the new version of your file, and voila! You can edit and preview and edit and preview until you get the file right.
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 really wrong-if you’re getting a blank screen or you’re getting some really 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 editor (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.

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.
NOTE
There are two exceptions to this rule, a tag called <pre> and a CSS property. You’ll learn about both of them in lesson 6, “formatting text with HTML and CSS”.
the advantage of having all white space (spaces, tabs, returns) ignored is that you can put your tags wherever you want. the Following examples all produce the same output.
TRY THEM!
<h1> if music be the food of love, play on.</h1>
<h1>
If music be the food of love, play on.
<h1>
If music be the food of love, play on. </h1>
<h1> if music be the food of love, play on.</h1>
Play on.<.h1>

No comments:

Post a Comment