Home > Articles > Networking

  • Print
  • + Share This

Tip 3: Using Tables

Just as in HTML, WML provides a table element used to display data in a row-and-column format. Tables are not as widely used in WML as they are in HTML simply because most information is laid out very simply on a screen (without lots of nested tables, as is common with nearly all HTML sites now). Because tables are somewhat uncommon, I should also note that some WAP browsers don't support them at all or may only partially support their use. Be sure to verify that tables are supported; if in doubt as to the browser being used by your user base, skip this feature.

After all that explanation, you'll be relieved to learn that tables in WML look nearly identical to those of their HTML cousins. All rows are contained within the <tr></tr> tag set and columns are contained within the <td></td> tag set. One difference is the use of the columns and align attributes within the <table> tag to specify the number of columns and alignment used. columns speaks for itself: If you want to define a table with three columns, set columns="3". align is a bit trickier, but very cool nonetheless! You may recall that traditional HTML allows you to "globally" set the alignment of text within a table (such as "center" or "left") but then requires you to custom set the content of a row or column, if so desired. WML allows all of this to be done within the align attribute through the use of the "L", "C", and "R" characters (standing for "Left", "Center", and "Right", respectively). In the following example, a three-column table is defined with the first and third column being centered, and the second column being right-aligned:

<table columns="3" align="CRC">
          <td>Team: Washington Redskins</td>
          <td>Stadium:  RFK Stadium</td>
          <td>City:  Washington, D.C.</td>
          <td>Team:  Baltimore Ravens</td>
          <td>Stadium:  PSI-Net Stadium</td>
          <td>City:  Baltimore, MD</td>

Tables sound nice in theory but in practice are very difficult to use, given the tiny screen sizes of most WAP devices. (Imagine the three columns listed above spread across a one-inch screen!) Still, table support is important and will be more widely used as screen sizes improve over the next few years.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.