WML Tutorial on WML Tables

the <table> element along with <tr> and <td> is used to create a table in wml. wml does not allow the nesting of tables

a <table> element should be put with-in <p>...</p> elements.

the <table /> element supports the following attributes:

attribute value description
columns number sets the number of columns in the table
align
  • l
  • c
  • r
to specify the horizontal text alignment of the columns, you need to assign three letters to the align attribute. each letter represents the horizontal text alignment of a column. the letter can be l, c, or r. for example, if you want the following settings to be applied to your table:
  • first table column -- left-aligned

  • second table column -- center-aligned

  • third table column -- right-aligned

then you should set the value of the align attribute to lcr.

xml:lang language_code sets the language used in the element
class class data sets a class name for the element.
id element id a unique id for the element.

following is the example showing usage of <table> element.

<?xml version="1.0"?>
<!doctype wml public "-//wapforum//dtd wml 1.2//en"
"http://www.wapforum.org/dtd/wml12.dtd">

<wml>

<card title="wml tables">
<p>
<table columns="3" align="lcr">
	<tr>
	  <td>col 1</td>
	  <td>col 2</td>
	  <td>col 3</td>
	</tr>

	<tr>
	  <td>a</td>
	  <td>b</td>
	  <td>c</td>
	</tr>

	<tr>
	  <td>d</td>
	  <td>e</td>
	  <td>f</td>
	</tr>
</table>
</p>
</card>

</wml>

this will produce the following result:

wap example 5