Learning web design third edition

Page 104

www.it-ebooks.info Some Special Characters

belong to multiple classes. In this example, I’ve classified each div as a “book” to set them apart from “cd” or “dvd” listings elsewhere in the document. <div id="ISBN0321127307" class="listing book"> <img src="felici.gif" alt="CMT cover"> <p><cite>The Complete Manual of Typography</cite>, James Felici</p> <p class="description">A combination of type history and examples of good and bad type.</p> </div> <div id="ISBN0881792063" class="listing book"> <img src="bringhurst.gif" alt="ETS cover"> <p><cite>The Elements of Typographic Style</cite>, Robert Bringhurst</p> <p class="description">This lovely, well-written book is concerned foremost with creating beautiful typography.</p> </div>

This should have given you a good introduction to how div and span are used to provide meaning and organization to documents. We’ll work with them even more in the style sheet chapters in Part III.

Some Special Characters There’s just one more text-related topic before we move on. Some common characters, such as the copyright symbol ©, are not part of the standard set of ASCII characters, which contains only letters, numbers, and a few basic symbols. Other characters, such as the less-than symbol (<), are available, but if you put one in an (X)HTML document, the browser will interpret it as the beginning of a tag. Characters such as these must be escaped in the source document. Escaping means that instead of typing in the character itself, you represent it by its numeric or named character reference. When the browser sees the character reference, it substitutes the proper character in that spot when the page is displayed. There are two ways of referring to a specific character: by an assigned numeric value (numeric entity) or using a predefined abbreviated name for the character (called a named entity). All character references begin with a “&” and end with an “;”. Some examples will make this clear. I’d like to add a copyright symbol to my page. The typical Mac keyboard command, Option-G, which works in my word processing program, won’t work in XHTML. Instead, I must use the named entity © (or its numeric equivalent ©) where I want the symbol to appear (Figure 5-12). <p>All content copyright © 2007, Jennifer Robbins</p>

or: <p>All content copyright © 2007, Jennifer Robbins</p>

Chapter 5, Marking Up Text

89


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.