Convert Text to HTML


As you begin to think about what you would like to put on your Web site, you might be wondering about material that you already have written but that is not “Web ready” yet. Maybe you have some recipes or short stories you’ve written. Or you might want to put your company’s employee manual online. Will you have to retype all that information? Not if you learn how to convert it to HTML. Although it’s possible to have a word processor save a file in HTML format, it’s not a great idea. Word processors tend to generate messy HTML. Besides, it’s quite easy to convert text to HTML.

Import Text into an HTML Page

Importing text into your HTML document is as easy as using the cut and paste options in Windows. However, when you import your text, you will notice that it has lost all of its formatting.You will learn in Chapter 2 how to use HTML elements to redefine the structure of your text.

  1. Open template.htm in Notepad.

  2. Open the document you want to import in your word processing program.

  3. Select the text you want to import and copy it to the clipboard.

  4. In Notepad, paste the text in between the <body> tags and then save the document under a different file name (so you don’t ruin your template).

  5. Now, display the page in your browser.

When you import text into an HTML document, it loses any formatting it originally had. It will simply appear as a solid block of text. If you want the material you imported to be organized or structured in some way, you’ll have to do it with HTML elements. In the next couple of chapters, you’ll learn how to take your text and shape it up with text elements.

Convert a Page of Text to HTML

Another way to transform material you already have into a Web page is to simply save the file as a text file (but using an HTML extension). Then add the necessary HTML tags (see Figure 1-3). The main thing to remember is that you must save the file as a plain text file, not as a word processor file. Otherwise, the word processor’s codes will interfere with your HTML.

click to expand
Figure 1-3: A word processor document with HTML tags added

  1. Open the file you want to convert to HTML.

  2. At the top of the document, type <html><head><title>Convert Text</title> </head><body>.

  3. At the end of the document, type </body></html>.

  4. From the File menu, choose Save As.

  5. Choose Save As Text and name the file convert.htm.

  6. Open the file in your browser.




How to Do Everything with HTML & XHTML
How to Do Everything with HTML & XHTML
ISBN: 0072231297
EAN: 2147483647
Year: 2003
Pages: 126

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net