Getting to Know HTML’s Basic Structure Tags
One of the most important concepts you need to understand as you get started with HTML is that whatever text you shoehorn between the <body> and </body> tags has almost no structure. To show you what I mean, I copied the first few headings and paragraphs of this section and pasted them into an HTML file. Figure 1-1 shows what happens when I open the HTML file in a web browser.
The resulting web page is anything but pretty and is very hard to read. Why? Because unlike the nicely structured — and therefore eminently readable — text you’re eyeballing right now, all that structure got thrown out the window when I pasted the text into the HTML file. Remember, HTML files are really just plain-text files, so all the fancy formatting and styles that were in my original Microsoft Word document were discarded.
Fortunately, this absence of formatting does not mean that you can’t build well-structured web documents. The secret to getting your web pages to look every bit as nice as the page you’re reading is HTML’s powerful collection of structure elements. Using these elements, you can create standard structures such as paragraphs and headings, as well as larger page items such as headers, articles, and footers.
Creating paragraphs
One of the main themes of this chapter is to explore various ways to avoid presenting your web page visitors with a mass of mostly undifferentiated text, like the example shown earlier in Figure 1-1. Why? Because such text is off-putting to look at and difficult to read.
Almost all of HTML has that theme in mind and, in the broadest interpretation, almost every HTML element is designed to structurally differentiate text in some way.