|
|||
|
EarthWeb sites: |
Chapter 18Other HTML 3.0 Proposals
CONTENTS
Although the HTML 3.0 standard as a whole has been "tabled" by the W3C, it looks like bits and pieces of it will continue to trickle out as parts of the standard are agreed upon. This can only be helped by the increased participation of the major Internet software vendors in the W3C's standardization process.
While everything from the 1995 HTML 3.0 draft won't make it, there
are probably a few HTML 3.0 specifications that will be widely
accepted by popular Web browsers. HTML needs a good way for folks
to offer math functions on their Web pages, without resorting
to clipping images from screenshots of other programs. Also in
the works is the banner element, which has some similarity to
Netscape's frame tags. Finally, you'll take a quick look at how
HTML style sheets will most likely work and, hopefully, give designers
complete control over the way a Web page displays.
HTML MathAt the time of writing, it's a bit tough to pin down exactly what the future holds for HTML 3.0 math functions. It seems certain that a nice chunk of HTML designers would appreciate the ability to create math functions in their HTML code (instead or resorting to images of complex math); but the HTML 3.0 standard has expired, and no other math-related proposals have appeared. What there is of the math functions is sketchy, but this section should give you a feel for how things might work. The HTML 3.0 specification introduces a new tag, <MATH>, which is a container tag that supports various other tags and HTML shortrefs (shortcuts for some <MATH> tags) to help you create mathematical formulae. The <MATH> tag works something like the following: <MATH>math formula/markup</MATH> The actual tags used for creating <MATH> formulae are still a little scarce, since the standard isn't exactly universally accepting. Let's look at some of the more basic tags. Math Tags
Among the math tags that you can put your fingers on now are the
<SUB>, <SUP>,
<BOX>, and <OVER>
tags. These tags can go a long way to represent most algebraic
and some calculus-level formulae, although the list is by no means
exhaustive.
Also, all of these but <OVER> are container tags. <SUB> and <SUP> turn text into subscripts and superscript, respectively. The shortref for <SUB> is the underscore (_), while the shortref for <SUP> is the caret (^). An example of these would be the following: <MATH>A<SUB>2</SUB>=45<SUP>3</SUP></MATH> Or, it could be the following, using the shortrefs: <MATH>A_2_=45^3^</MATH> Unfortunately, none of the popular browsers I have available to test can render these <MATH> tags. I'm using a slightly more obscure browser called UdiWWW for Windows (available on the Web at http://www.uni-ulm.de/~richter/udiwww/index.htm) to view these HTML 3.0 specific <MATH> elements in figure 18.1. Figure 18.1: <MATH> rendering in future browsers. The <BOX> tag is used for invisible brackets, delimiters, and integral signs, and to suggest that something is going to be placed over something else. The <OVER> tag does the actual placing, so that the following: <MATH><BOX>f(x)<OVER>1+x</BOX></MATH> would put f(x) over 1+x. I'm not sure that the <BOX> element is really necessary at this point, but I imagine, just like good parenthesis in any mathematical equation, <BOX> can't hurt (unless you use it in the wrong part of your equation). The following is an example where <BOX> is mandatory: <MATH>∫_a_^b^<BOX>f(x)<OVER>1+x</BOX> dx</MATH> The shortref for <BOX> is {, and for </BOX>, it's }. So, you could enter the above example as the following: <MATH>∫_a_^b^{f(x)<OVER>1+x} dx</MATH> which is almost easy to look at (unless you had my experiences with calculus in college). To see what all this might look like in a browser, glance at figure 18.2.
Figure 18.2: Integration with MTML 3.0-style math tags.
Other Math TagsOther math tags are available in the HTML 3.0 standard that perform more specific tasks. These <VEC>, <BAR>, <DOT>, <DDOT>, <HAT>, and <TILDE> tags are container tags designed to affect certain variable names or parts of a formula by placing a particular symbol over the enclosed character or text. Respectively, they add a vector, bar, dot, double-dot, hat, or tilde above the enclosed text. An example might be the following: <MATH><HAT>O</HAT> = <DOT>A</DOT></MATH> which would render in a browser similar to figure 18.3. Figure 18.3: Viewing other math tags in UdiWWW. Two other tags allow you to create roots in your formulae: <SQRT> and <ROOT>. Both are container tags, and <ROOT> includes an empty tag, <OF>, that allows you to define the radix of the root function. The following: <SQRT>1 + x</SQRT> and <ROOT>3<OF>1 + x</ROOT> are both possible between <MATH> tags, forcing the browser to render these with a root bracket in the appropriate place, as in the following example (see fig. 18.4): Figure 18.4: Using the <SORT> and <ROOT> tags. <MATH><SUP>1</SUP><ABOVE>5 + 3</ABOVE></MATH> The final tag is the <TEXT> tag, which simply allows you to add regular text within a <MATH> container. It's often combined with the <SUP> or <SUB> tags (and <ABOVE> or <BELOW>) to allow you to describe variables or formula elements, like the following: <MATH>1<OVER><TEXT>The sum of all x's</TEXT></MATH> The Banner ElementIf you're familiar with Netscape's frames concept at all, then the <BANNER> tag of the HTML 3.0 standard is something you might find interesting. Essentially, the <BANNER> container is used to fix a portion of your HTML page so that it doesn't scroll with the rest of the document. This gives you the ability to put a corporate logo, for instance, or navigation buttons (even an image map) in a portion of the screen that won't move, even if the rest of the document extends past the viewable page. The question is, will <BANNER> live on? No popular browsers that I'm aware of support the tag, and it may be too similar to Netscape's frames to survive, since frames can also be used elsewhere on the page and they can access different URLs (effectively dividing a page to display more than one Web site at a time). Check http://www.w3.org/ and elsewhere before incorporating the <BANNER> element into your pages. If you accidentally memorize how to use the <BANNER> tag, and it turns out not to be supported-well, I can hardly blame you, because it's not a terribly complicated tag. It follows the format: <BODY> The <BANNER> tag is fairly straightforward. An example of the <BANNER> tag is the following: <BANNER> Once you have enough information on the page to cause it to scroll, you'll see that the banner section doesn't scroll along with the rest of the text. Document-Defined Style SheetsThe age-old debate in the HTML world (okay, so the debate's a year-and-a-half old) is the push and pull between designers who want control over the display of their pages and the standard-bearers who want the widest possible audience for Web pages. Up until now, it's been something of a stand-off, with companies like Netscape adding non-standard HTML-like references to their browsers' capabilities, while the standards organizations have ignored or repudiated those attempts. The new world order of HTML standard creation may have finally changed that a bit. The W3C now comprises representatives of both camps-both the HTML standard-creators and the strongest corporate players in Web creation tools. So, the two philosophies have begun to merge, and style sheets seem to be one of their answers. Put simply, a style sheet is a designer-suggested mechanism for the layout of a page. The magic of style sheets is that they can become almost infinitely complicated from the standpoint of the designer. You can decide minute details like character spacing, color, font families, and other desktop publishing-type decisions. At the same time, however, not rendering these decisions is up to the individual user and browser, so that minimal information is lost, and the majority of browsers can view your information from whatever platform they choose.
Let's take a cursory look at style sheets. Although part of the
now-expired HTML 3.0 standard, the current thinking in style sheets
is about three weeks old as of this writing. Will it change? I
can almost guarantee it. I'll try to pick the parts that seemed
destined to remain intact.
The <STYLE> TagIt seems to me that the <STYLE> tag is the easiest to understand when it comes to style sheets in HTML, and I'd like to talk about it first. You're in the <HEAD> section of your document now, and you'll use the <STYLE> container to define some of the style elements you want to add to our Web page. The basic format is the following: <HEAD> Looks like this will require some explaining. For your purposes, the TYPE attribute of the <STYLE> tag will always accept the MIME type text/css. That stands for the cascading style sheets (CSS) standard for Web style, and it is basically just a standard that defines what sort of things you can do to text, images, and background on your Web page. It defines the special formatting codes you'll use within your <STYLE> definition. HTML tag refers to any of the HTML you've learned thus far. Nearly all of them can be given a .class which creates a unique instance of this particular tag. When that class is specified in the body portion of your document, the special formatting will be used for that particular instance of the HTML tag. Let's look at an example: <HEAD> Now, with these style definitions, you've created new classes of the familiar <H1> and <P> tags named italic and red_caps, respectively. When you want these special instances to occur in our HTML document, use the CLASS attribute to the standard HTML tag. Therefore, the following would create the special cases for our HTML tags within the document itself: <H1 CLASS="italic">This header is italicized</H1>
Notice that the original pseudo-code example offered another new tag, the <SPAN> tag. <SPAN> is basically a designer-defined tag that allows you to create a special case for emphasizing certain text in your document. It works just like the <EM> tag except for one small detail-it has no HTML 2.0 counterpart. So, browsers that don't recognize style sheets won't interpret the <SPAN> element in any way. If you used a pre-existing tag, other browsers would only see half of your formatting. Consider this example. In the <HEAD> section, you define <SPAN>: <STYLE TYPE="text/css"> Now, in the body of your document, you can do the following: <P><SPAN>Welcome to</SPAN> my home page on the Web. I'm glad you could find the time to drop by and see what we've got going today.</P> In a style sheet-capable browser, you'll see small caps used for an attractive, printed-style introduction to your paragraph. In older browsers, the text is unaffected. The CSS Style Sheet DefinitionHaving seen how certain style elements can be defined for your Web page, you might be interested in learning all of the different style changes you can make to your documents. There are two things you should recognize about this. First of all, the CSS style sheet definition is only one of infinite possible style sheet definitions. That means that anyone can create a style sheet definition, give it a MIME name like text/bob, and create a browser that includes all of the programming required to render the elements of that style sheet. This can get very tedious to learn and design by hand, which is part of the fodder for my argument that style sheets are the beginning of the end of simple (unassisted) HTML layout. Fortunately for you, the W3C (along with the corporations behind popular browsers) have just announced at the time of writing that the CSS will be the first standard for style sheets. That, at least, gives you common ground to work with when you set out to design Web pages for the general public. And, of course, the magic of style sheets is that if a browser can't use them, it won't. No basic information is lost. The second major point is this: the current working draft of the CSS style sheet definition is over 40 pages long-and it's basically full of possible style properties. That means things go much deeper than { color: red } in CSS. I'll touch on some of the high points, but if you get very deep into style sheets, you'll want to consult http://www.w3.org/pub/WWW/TR/WD-css1.html for the latest CSS Level 1 developments and changes.
Table 18.1 offers some of the more likely CSS defined style properties
and their possible values or value types.
You can probably figure out what most of these do, but I want to point out something about a few of them. The FONT property is basically a shorthand reference for the four properties that precede it in the table. You can simple use any of the related values for FONT, effectively describing its entire appearance in one tag. With any font tag, you probably want to be as generic with font names (like Helvetica or Courier) as possible, since the user's browser will have to decide what that font name's closest counterpart is on the user's system. The possible values for COLOR include black, red, white, green, blue, yellow, brown, gray, orange, and purple. You can also add "light" or "dark" to any of these colors. Also, remember that you're acting on a particular tag (most of the time) and that color most often refers to text color. It can be used with any text-related tag, like <BLOCKQUOTE>, as in the following example: <STYLE TYPE="text/css"> And, you'd call it just like any other CLASS of an HTML tag: <BLOCKQUOTE CLASS="helv_red">Blockquote class</BLOCKQUOTE> The properties VERTICAL-ALIGN and TEXT-ALIGN give Web designers the much-desired control over centering and justifying text in a document. The BACKGROUND property is most often used in conjunction with the <BODY> tag, although you can technically change the background of nearly element. The background can be a color, two colors (blended in the background), or a URL to a graphic file. You can also include both color and file, so that a background color is used if the file isn't found. Here's an example: <HEAD> Example: Incorporating a Style SheetFor the most part, a style sheet should be secondary to the communicative nature of your text and graphics. Ideally, this is a page that would work for both HTML 2.0 users and users with style sheet-capable browsers. Let's put together a small style sheet and HTML page. Save a new HTML document from your template and enter Listing 18.1. Listing 18.1 style1.html Creating a Style Sheet <HTML> Once you've got that entered, you meet up with the second half of the example. Now I just want you to load the page and see what parts (if any) of the style sheet your browser is capable of displaying. Depending on how quickly browsers begin to incorporate style sheets, a more mainstream browser (like Netscape Navigator or MS Internet Explorer) may display this page just as completely. To view the page, use the Open File command in your browser. Then check to see how your page looks. External Style Sheets and Other Style Sheet TagsLet's talk a little more about some of the other new elements you can use, and how you can use a single style sheet for more than one page on your site. To use an external style sheet, you need to drop back to the <LINK> tag which was first discussed in Chapter 10. The <LINK> TagIn this case, <LINK> will serve a more specific purpose for your Web page than it has in previous discussions. Using the REL attribute for the <LINK> tag, you can add the STYLE elements from the linked page to the current page. Predefined style classes can then be used in the current HTML markup. This version of the <LINK> tag works like this: <LINK TITLE="link_doc_title" REL=stylesheet HREF="URL" TYPE="text/css"> The TYPE can accept any style sheet type you might be interested in using-we're sticking with CSS. The TITLE should be the same as the remote file's title and the HREF URL needs to be an URL to the document that includes the <STYLE> definition that you also want to use for the current page. An example might be: <LINK TITLE="MY STYLE" REL=stylesheet HREF="my.style" TYPE="text/css"> So what type of file are you linking to? If you prefer, you can simply link to a common HTML file that defines the style for your Web site. Even your index page can serve as this common style page, if it includes a <STYLE> definition. Or, you can create a document that includes nothing but a <STYLE> container and style page definitions. HTML and head/body tags aren't required since the <LINK> tag is essentially "replaced" in the current document with the <STYLE> information. And the <LINK> tag is already in the appropriate place for that <STYLE> information-between the <HEAD> tags. Style OverridesWith either a <LINK> tag or a <STYLE> tag defined in the head of your document, you can use not only the currently defined classes for creating styles, but also overrides to change the style of nearly any HTML tag. How does this work? It's similar to defining style classes, but you instead use the STYLE attribute with any legal HTML tag. The following is an example: <P STYLE="text align: center"> This paragraph is centered, even if it You can see where the flexibility of style sheets is almost getting out of control. Although you can call these overrides for your current style sheet, the truth is that you can use these STYLE-attributed HTML tags anytime that you want to-as long as you've defined the text/css type through a <STYLE> or <LINK> tag in the head of your document. So, if you'd prefer to generate your style elements on-the-fly, you can define a <LINK> or empty <STYLE> tag that does little more than define the TYPE as text/css. Divisions and the ALIGN AttributeThe style sheet standard also creates another tag, the <DIV> (division) tag, that allows you to assign attributes to a particular part of your document. <DIV> is a container tag that applies different styles to anything, including images, placed between the two tags. Ultimately, it gives the designer another level of organization for your Web page. If you think of a <DIV> as one level below the <BODY> tag, you're on the right track. The <DIV> tag works like this: <DIV CLASS="class_name" ALIGN="direction">
Notice that the <DIV>
tag can accept the same CLASS
attribute that most other HTML tags can take when used with a
style sheet. This allows you to create a division of your HTML
pages that accepts particular style properties. In addition, the
<DIV> tag can take
the attribute ALIGN, which
can accept LEFT, CENTER,
RIGHT, or JUSTIFY.
Let's take a look at the <DIV> tag in action: <DIV ALIGN="CENTER"> Here, finally, is an HTML 3.0 tag you can view in the most popular browsers (see fig. 18.5). You can use the <DIV> tag with style sheets in the following example. Figure 18.5: The <DIV> tag centers items in Netscape Navigator. Example: Styles and the <DIV> TagLet's incorporate everything you've learned so far about style sheets and the <DIV> tag. You'll still define a minimal style sheet in the head of your document, but you'll use overrides for the bulk of the text. You'll also use the <DIV> tag to apply styles and global alignment. Create a new HTML document based on your template, then enter something similar to Listing 18.2. Listing 18.2 style2.html Using the <DIV> Tag With Styles <HTML> You get the idea. You can notice two things from this listing, both related to the style sheets and <DIV> tags discussed in this chapter. First, they are both very flexible and offer unprecedented control over page layout. Second, they can really fill up an HTML document fast. It may be best to define a style sheet and use the CLASS attribute whenever possible. Overrides for every element can be overkill-but, then again, there's a lot you can do to make you pages better looking. SummaryA number of HTML 3.0 proposals are currently fighting for survival in the W3C and other places where HTML standards are created. With the demise of the original HTML 3.0 standard, current HTML 3.0 level components are being standardized one at a time. So, the future of math tags, the banner element, and style sheets are still up in the air. Math tags will most likely be implemented because they fill a need in the HTML world for a convenient way to represent mathematical formulae without requiring the designer to use images created by other programs. The banner element might not be so lucky, since it has a lot in common with the frames tags proposed by Netscape. Style sheets do look like they'll survive, but they'll also be somewhat complicated to implement. At their most basic, they offer designers unprecedented control over the look of their Web pages. At their most complicated, they'll probably require sophisticated applications (along the same lines as desktop publishing programs) for precision layout. Review Questions
Review Exercises
|
Use of this site is subject certain Terms & Conditions. Copyright (c) 1996-1999 EarthWeb, Inc.. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Please read our privacy policy for details. |