Share this Page URL

Chapter 3. From Buck-Naked to Beautiful:... > A Few Formatting Features You'll Use... - Pg. 31

From Buck-Naked to Beautiful: Dressing Up Your Page <P ALIGN="RIGHT"> 31 And if your page doesn't display properly when you view it in the browser, immediately check to see if you left off either the opening or closing quotation mark. Similarly, you can center, say, an <H1> heading like so: <H1 ALIGN="CENTER"> The advantage to this approach is that you can also use either LEFT or RIGHT with the ALIGN attribute to further adjust your paragraph alignment. The LEFT value aligns the text on the left side of the window (that is, the normal alignment), and the RIGHT attribute aligns the text on the right side of the window. Handling Preformatted Text In the previous chapter, I told you that web browsers ignore white space (multiple spaces and tabs) as well as carriage returns. Well, I lied. Sort of. You see, all browsers normally do spit out these elements, but you can talk a browser into swallowing them whole by using the <PRE> tag. The "PRE" part is short for "preformatted," and you normally use this tag to display preformatted text exactly as it's laid out. Here, "preformatted" means text in which you use spaces, tabs, and carriage returns to line things up. Let's look at an example. The following bit of code is an HTML document (look for pre.htm on this book's CD) in which I set up two chunks of text in a pattern that uses spaces and carriage returns. The first bit of doggerel doesn't make use of the <PRE> tag, but I've surrounded the second poem with <PRE> and </PRE>. Figure 3.3 shows the results. Notice that the lines from the first poem are