| < Day Day Up > |
The new version of HTML, called XHTML, became a W3C Recommendation in January 2000. XHTML is a reformulation of HTML using XML that attempts to change the direction and use of HTML to the way it ought to be. So what does that mean? In short, rules now matter. In the past, you could feed your browser just about anything and it would render. XHTML ends all that. Now if you make a mistake, it should matter. Theoretically, a conformant browser shouldn't
You must have a doctype indicator and conform to its rules. For example,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/ xhtml1/DTD/xhtml1-transitional.dtd">
You must have <html> , <head> , and <body> (or a <frameset> containing a <body> inside of a <noframes> tag).
<title> must come first in the < head> element.
You have to quote all your attributes, even simple ones such as <p align= "left"> .
You must nest your tags properly, so <i><b> is okay </b></i>, but <i><b> is not </i></b> .
You cannot omit optional close tags, so <p> cannot stand alone; you must have <p> and </p> .
Empty tags must close, so tags such as <hr> become <hr /> .
You must lowercase all tags and attribute
There's more, but this is most of them. Except for a few changes in syntax, such as the empty tag changes and the forced lowercase, just do your HTML correctly (as you should have done before).
Although XHTML doesn't appear to be a big deal, it is. Enforcing rules is going to cause problems and widespread use will take time, considering the amount of developer education, tool changes, and browser updates required. Most existing Web pages will also have to be restructured to some degree. So the big question is this: Will this really come to pass? Since the third edition of this book little actually has changed in Web development and few major sites use XHTML. However, designers are finally starting to get interested in it, particularly given the modern browsers' support for the technology.
| < Day Day Up > |
| < Day Day Up > |
Before finishing the chapter, we need to take a look at some of the major
No introduction to HTML would be complete without a discussion of the logical versus physical markup battle at the heart of HTML.
Physical HTML
refers to using HTML to make pages look a particular way;
logical HTML
refers to using HTML to specify the structure of a document while using another technology, such as Cascading Style Sheets (CSS) as discussed in Chapters 10 and 11, to
Most people are already very familiar with physical document design because they normally use WYSIWYG ( what you see is what you get ) text editors, such as Microsoft Word. When Word users want to make something bold, they simply select the appropriate button, and the text is made bold. In HTML, you can make something bold simply by enclosing it within the <b> and </b> tags, as shown here:
<b> This is important. </b>
This can easily lead people to believe that HTML is nothing more than a simple formatting language. WYSIWYG HTML editors (such as Microsoft FrontPage) also
According to most markup experts, HTML really was not designed to provide most of the document layout features people have come to expect, and it shouldn't be used for that purpose. Instead, HTML should be used as a logical, or generalized, markup language that defines a document's structure, not its appearance. For example, instead of defining the introduction of a document with a particular margin, font, and
Even traditional HTML contains mostly logical elements. An example of a logical element is <strong> , which indicates something of importance, as shown here:
<strong> This is important. </strong>
The
strong
element says nothing about how the phrase "This is important" will actually appear, although it probably will be rendered in bold. Although many of HTML's logical elements are relatively
The benefits of logical elements might not be obvious to those comfortable with physical markup. To understand the benefits, it's important to realize that on the Web, many browsers render things differently. In addition, predicting what the viewing environment will be is difficult. What browser does the user have? What is his or her monitor's screen resolution? Does the user even have a screen? Considering the extreme of the
Many realistic examples exist of the power of logical elements. Consider the multinational or multilingual aspects of the Web. In some
Whether you subscribe to the physical (specific) or logical (general) viewpoint, traditional HTML is not purely a physical
or
logical language yet. In other words, currently used HTML elements come in both flavors ”physical and logical ”and developers nearly always think of them as physical. Elements that specify fonts, type sizes, type styles, and so on are physical. Tags that specify content or importance, such as
<cite>
and
<h1>
, and let the browser decide how to do things are logical. A quick look at Web pages across the Internet suggests that logical elements and style sheets often go unused because while Web developers want more layout control than raw HTML provides, style sheets are still not well
Just because a standard is defined doesn't
The amount of hearsay, myths, and complete misunderstandings about HTML and XHTML is
HTML isn't a specific, screen- or printer-precise formatting language like PostScript. Many people struggle with HTML on a daily basis, trying to create perfect layouts by using HTML elements inappropriately or by using images to make up for HTML's lack of screen and font- handling features. Interestingly, even the concept of a visual WYSIWG editor propagates this myth of HTML as a page layout language. Other technologies, such as Cascading Style Sheets (CSS), are far better than HTML for handling presentation issues and their use returns HTML back to its structural roots.
Many people think that making HTML pages is similar to programming. However, HTML is unlike programming in that it does not specify logic. It specifies the structure of a document. With the introduction of scripting languages such as JavaScript, however, the dynamic HTML (DHTML) is becoming more and more popular and is used to create highly interactive Web pages. Simply put, DHTML is the idea of a scripting language like JavaScript dynamically modifying HTML elements. DHTML blurs the lines between HTML as a layout language and HTML as a programming environment. However, the line should be distinct because HTML is not a programming language. Heavily intermixing JavaScript with HTML markup in the ad-hoc manner that many authors do is far
HTML is the foundation of the Web; with literally billions of pages in existence, not every document is going to be upgraded
Wishful thinking, but having taught HTML for years and having seen firsthand how both editors and others build Web pages, I can tell you that it is very
Although HTML has had rules for years, much of the time people don't really bother to follow them because they see little penalty nor obvious benefit to actually
Although some will continue to craft pages like mechanical typesetting, as the Web editors improve and produce standard markup
Although HTML is the basis for Web pages, you need to know a lot more than HTML to build useful Web pages (unless the page is very simple). Document design, graphic design, and quite often programming are necessary to create sophisticated Web pages. HTML serves as the foundation for all of these
| < Day Day Up > |