HTML, XHTML and CSS All-In-One for Dummies - Andy Harris [13]
♦ It works on all computers. The main point of HTML is to have a universal format. Any computer should be able to read and write it. The plain-text formatting aids in this.
♦ It describes what documents mean. HTML isn’t really designed to indicate how a page or its elements look. HTML is about describing the meaning of various elements (more on that very soon). This has some distinct advantages when you figure out how to use HTML properly.
♦ It doesn’t describe how documents look. This one seems strange. Of course, when you look at Figure 1-1, you can see that the appearance of the text on the Web page has changed from the way the text looked in your text editor. Formatting a document in HTML does cause the document’s appearance to change. That’s not the point of HTML, though. You discover in Book II and Book III how to use another powerful technology — CSS — to change the appearance of a page after you define its meaning. This separation of meaning from layout is one of the best features of HTML.
♦ It’s easy to write. Sure, HTML gets a little more complicated than this first example, but you can easily figure out how to write HTML without any specialized editors. You only have to know a handful of elements, and they’re pretty straightforward.
♦ It’s free. HTML doesn’t cost anything to use, primarily because it isn’t owned by anyone. No corporation has control of it (although a couple have tried), and nobody has a patent on it. The fact that this technology is freely available to anyone is a huge advantage.
Meeting Your New Friends, the Tags
The key to writing HTML code is the special text inside angle braces (<>). These special elements are tags. They aren’t meant to be displayed on the Web page but offer instructions to the Web browser about the meaning of the text. The tags are meant to be embedded into each other to indicate the organization of the page. This basic page introduces you to all the major tags you’ll encounter. (There are more, but they can wait for a chapter or two.) Each tag has a beginning and an end tag. The end tag is just like the beginning tag, except the end tag has a slash (/):
♦ : The tag is the foundation of the entire Web page. The tag begins the page. Likewise, ends the page. For example, the page begins with and ends with . The combination indicates that everything in the page is defined as HTML code.
Some books teach you to write your HTML tags in uppercase letters. This was once a standard, but it is no longer recommended. When you move to XHTML code (which is a slightly stricter form of HTML) in Chapter 2 of this minibook, you’ll see that XHTML requires all tags to be lowercase.
♦
: These tags define a special part of the Web page called the head (or sometimes header). This part of the Web page reminds me of the engine compartment of a car. This is where you put some great stuff later, but it’s not where the main document lives. For now, the only thing you’ll put in the header is the document’s title. Later, you’ll add styling information and programming code to make your pages sing and dance.♦ : This tag indicates a comment, which is ignored by the browser. However, a comment is used to describe what’s going on in a particular part of the code.
♦
Throughout this book, I use the filename of the HTML code as the title. That way, you can match any figure or code listing to the corresponding file on the Web site that accompanies this book. Typically, you