Tables

Tables are one of the worst-supported features in WML, at least in browsers available at the time of writing. The reason for this is that displaying tables properly (as laid down in the WAP specifications) often requires a lot of screen space, which is at a premium on devices such as cell phones. For example, at least one browser currently available displays each cell of a table on a new line, with lines of * characters to mark the places where rows should have started.

WML also doesn’t allow user interface elements to appear in tables, except for anchored text (using the <a> or <anchor> elements). This makes it easier for those browsers that do support tables. You are, however, allowed images, text-style changes, and even line breaks.

WML tables include a number of rows, each containing a number of cells. The cells may themselves contain multiple lines of text, due to embedded <br/> tags, but these are all considered part of the same cell.

The <table> Element

This element declares a table in a WML card. It must appear inside a paragraph (in other words, inside a <p> element). A <table> contains nothing but <tr> elements giving its rows. It takes three attributes, giving details about the intended presentation of the table onscreen.

Attributes of the <table> element

columns (required number)

Specifies the number of columns in the table. If a row (a <tr> element) has fewer than this number of cells (<td> elements), the browser pads it with empty cells at the end of the row. ...

Get Learning WML, and WMLScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.