Section 14.3. XHTML Basic


14.3. XHTML Basic

Recognizing the inherent limitations in mobile browsing, and seeking to promote a standard content model for those devices, the World Wide Web Consortium (W3C) has defined a reduced version of XHTML that caters to these devices. Known as XHTML Basic , this version of XHTML defines a standard set of tags that are sufficient for creating effective content for mobile devices, yet are simple enough to ensure that they will be consistently adopted across a wide range of mobile browsers.

Be forewarned: just because a standard supports mobile devices doesn't mean that a browser will. Often hardware limitations prevent implementation.

14.3.1. Supported Tags

XHTML Basic is best addressed as several groups of tags that together define a minimal but useful version of XHTML.

14.3.1.1. Basic content

XHTML Basic wouldn't work if it didn't support the four core tags that define any document: <html> , <head> , <title> , and <body> . You should never write a document without these tags, of course, and you should use them to delimit your document accordingly .

More complicated document structure is not supported. XHTML Basic specifically excludes frames and layers from mobile web devices.

Within the document body, XHTML Basic supports a core set of text-structural tags, including the six heading tags ( <h1> tHRough <h6> ), <br> , <p> , <pre> , and <blockquote> . These are sufficient to create flows of text that are organized into paragraphs and blocks of text and are identified by headings at various levels, which makes for a readable document in any browser.

Within a text flow, XHTML Basic also supports all of the content-based style tags, including <abbr> , <acronym> , <address> , <cite> , <code> , <dfn> , <em> , <kbd> , <q> , <samp> , <strong> , and <var> . But given the paucity of fonts on most mobile devices, especially mobile phones, a mobile browser may be hard-pressed to even have more than one way to represent all these tags. This warning also applies to the heading tags, as it is highly unlikely that most mobile phones can offer six font sizes to distinguish the six heading tags.

Device font limitations also force the XHTML Basic standard to rule out the physical style tags, such as bold and italic text. With no guarantee that those styles will be available, it would be misleading to support the equivalent tags. Bidirectional text also is not supported; many mobile devices have a hard enough time rendering conventional text flows.

XHTML Basic has a strong focus on using stylesheets to manage the presentation of your mobile content, but not within the context of the page itself: the <style> tag itself is not supported. Instead, XHTML Basic defers to external stylesheets and, to support them, includes the <div> and <span> tags so that you can delimit your content and apply styles to it as needed. Use the class attribute to associate a style with that text.

Of course, XHTML Basic also supports the <a> tag so that you can link your pages to other documents.

14.3.1.2. Images, objects, and scripting

Although you should use it very judiciously, XHTML Basic does include the <img> tag. You should never drop images into your documents without due consideration, and even more so for mobile browsing, because they can dramatically affect the time needed to download a document and even may break certain browsers if they are too large. We offer more advice on using images effectively in your documents later in this chapter.

XHTML Basic also supports more general object embedding in mobile content with the <object> and <param> tags. While the intent is noble, these tags pave the road to heck for mobile browsing. Support is highly browser and device specific, and the mobile market is not yet mature enough to let authors assume broad support for any sort of embedded content beyond simple images. Nonetheless, if you are able to target your content to a specific device that provides appropriate support, these tags are here for your use.

XHTML Basic does not support scripting or event handling. None of the event-handling attributes is supported, nor are the <script> and <noscript> tags. Given the limited memory and computing power of the typical mobile device, this is not unreasonable. Highly dynamic, script-driven pages are better left to a full desktop browser.

14.3.1.3. Lists

In order to provide additional structure to your content, XHTML Basic supports ordered ( <ol> ), unordered ( <ul> ), and definition ( <dfn> ) lists and their supporting <li> , <dl> , <dd> , and <dt> tags. These lists can really help to organize and structure your content, especially navigation pages that offer multiple links to the user .

In particular, coupling a numbered list of links with the accesskey attribute in their associated <a> tags makes it very easy for a cell phone-based browser user to navigate your pages with a single press of a key.

14.3.1.4. Forms

Interactivity is another feature critical to web browsing, so XHTML Basic provides support for forms, including the basic structure and input elements <form> , <input> , <label> , <select> , <option> , and <textarea> tags. The XHTML Basic specification does not restrict the kinds of form elements that you might use, but keep in mind that some mobile devices may not support extremely large choice items or menus .

The only form elements specifically prohibited by the XHTML Basic standard are file and image uploading elements. Ironically, these would be attractive browser options for all those cell phones that sport built-in cameras by allowing users to upload pictures to a web server.

14.3.1.5. Tables

Web designers commonly use tables to structure content display. While you may achieve similar effects for the mobile browser, be judicious. Although not explicitly stated, the XHTML standard bearers frown on the practice and want you to use tables for tables of information, not layout.

XHTML Basic supports only the core table tags: <table> , <tr> , <td> , <th> , and <caption> . Fancier things, such as spanning columns and even nested tables, are specifically not supported by the XHTML Basic standard. Complex tables may not be rendered correctly, and the narrow display size can easily disrupt your intended table presentation. Subtle table effects, such as varying cell margins and rule widths, will almost certainly be handled inconsistently between mobile browsers and are best avoided to ensure broad compatibility of your content.

14.3.1.6. Document header

XHTML Basic supports a few of the common tags found in the document <head> ; specifically, the <meta> , <link> , and <base> tags. The primary intent of the <link> and <base> tags is to allow you to link to your stylesheets from within your mobile documents. Be somewhat cautious with the <meta> tag, though: the mobile browsers do not support all variations of its attributes.

14.3.2. Design Versus Intent

While the XHTML Basic standard defines a specific set of tags that should work on any compliant mobile browser, do not be misled into thinking that you can push the elements of XHTML Basic to the limit in designing your content. The mobile device market is too young and the browsers too immature to provide consistent support for every possible tag variation within XHTML Basic. More, ahem, mature designers may think back to when they were designing pages in the mid-90s, when creating content that worked across Netscape Navigator and early versions of Internet Explorer was challenging at best and more likely infuriating. Both browsers attempted to implement the early HTML standards, but there were too many variations in the products to make anyone 's life easy.

The intent of the mobile-web standard is to create a small set of tags that work reasonably well across a wide range of devices, from phones to PDAs to set-top boxes and other devices. The W3C even lists appliances such as smart refrigerators and washing machines as potential targets for human interactions through web pages. Good designers will stay within the intent of the design, using the tags in a reasonable manner and avoiding tricks and clever coding to implement a particular page. The resulting content will work well on lots of devices, and the designers will be calmer and happier people.



HTML & XHTML(c) The definitive guide
Data Networks: Routing, Security, and Performance Optimization
ISBN: 596527322
EAN: 2147483647
Year: 2004
Pages: 189
Authors: Tony Kenyon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net