Sams Teach Yourself HTML 4 in 24 Hours
- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Tell Us What You Think!
- Put Your HTML Page Online Today
- I. Your First Web Page
- Hour 1. Understanding HTML and XML
- Hour 2. Create a Web Page Right Now
- Hour 3. Linking to Other Web Pages
- Hour 4. Publishing Your HTML Pages
- II. Web Page Text
- Hour 5. Text Alignment and Lists
- Hour 6. Text Formatting and Font Control
- Hour 7. Email Links and Links Within a Page
- Hour 8. Creating HTML Forms
- III. Web Page Graphics
- Hour 9. Creating Your Own Web Page Graphics
- Hour 10. Putting Graphics on a Web Page
- Hour 11. Custom Backgrounds and Colors
- Hour 12. Creating Animated Graphics
- IV. Web Page Design
- Hour 13. Page Design and Layout
- Hour 14. Graphical Links and Imagemaps
- Hour 15. Advanced Layout with Tables
- Hour 16. Using Style Sheets
- V. Dynamic Web Pages
- Hour 17. Embedding Multimedia in Web Pages
- Hour 18. Interactive Pages with Applets and ActiveX
- Hour 19. Web Page Scripting for Non-Programmers
- Hour 20. Setting Pages in Motion with Dynamic HTML
- VI. Building a Web Site
- Hour 21. Multipage Layout with Frames
- Hour 22. Organizing and Managing a Web Site
- Hour 23. Helping People Find Your Web Pages
- Hour 24. Planning for the Future of HTML
- VII. Appendixes
- A. Readers' Most Frequently Asked Questions
- B. HTML Learning Resources on the Internet
- C. Complete HTML 4 Quick Reference
- D. HTML Character Entities
Paragraphs and Line Breaks
When a Web browser displays HTML pages, it pays no attention to line endings or the number of spaces between words. For example, the top poem in Figure 2.3 appears with a single space between all words in Figure 2.4. When the text reaches the edge of the Netscape window, it automatically wraps down to the next line, no matter where the line breaks were in the original HTML file.
Figure 2.3 In HTML, extra spaces and line breaks (like those in the top poem here) are ignored.
Figure 2.4 When the HTML in Figure 2.3 is viewed as a Web page, line and paragraph breaks only appear where there are <br /> and <p> tags.
You must use HTML tags to control where line and paragraph breaks actually appear. To skip a line between paragraphs, put a <p> tag at the beginning of each paragraph and a </p> tag at the end.
The <br> tag forces a line break within a paragraph. Unlike the other tags you've seen so far, <br> doesn't require a closing </br> tag. To conform to the new XML and XHTML standards (see Hour 24, "Planning for the Future of HTML" ), you should always include a / within any opening tag that doesn't have a closing tag, like this: <br /> .
The second poem in Figures 2.3 and 2.4 shows the <br /> and <p> tags being used to separate the lines and verses of a nursery rhyme and to separate two paragraphs of text commenting on the rhyme.
You might have also noticed the <hr /> tag in Figure 2.3, which causes a horizontal rule line to appear in Figure 2.4. Inserting a horizontal rule with the <hr /> tag also causes a line break, even if you don't include a <br /> tag along with it. For a little extra blank space above or below a horizontal rule, you can put a <p> tag before the <hr /> tag and a </p> tag after it.
Like <br />, the <hr /> horizontal rule tag never gets a closing </hr> tag.
Headings | Next Section

Account Sign In
View your cart