WML Formatting - WML

What are text formatting elements of WML?

Let’s discuss about the basic text formatting elements of WML.

Line Break:

The element discusses about a line break and almost all WAP browsers supports a line break tag.
The element supports the following attributes:
Attribute Value Description
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.
Here’s the example that explains about the usage of element.
This will produce the following result:
wap-example4

Text Paragraphs:

The <p> element encloses a paragraph of text and WAP browsers always render a paragraph in a new line.
A <p> element is designed to define any text, image or a table in WML.
The <p> element supports the following attributes:
Attribute Value Description
align
  • left
  • right
  • center
This is used to change the horizontal alignment of a paragraph.
mode
  • wrap
  • nowrap
Sets whether a paragraph should wrap lines or not.
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.
Here’s the example showing usage of <p> element.
This will produce the following result:
wap-example3 (1)

WML Tables:

The <table> element along with <tr> and <td> is used to generate 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 thealignattribute 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.
Here’s the example showing usage of <table> element.
This will produce the following result:
wap-example5 (1).gif

Preformatted Text:

The <pre> element commonly used to define preformatted text in WML. Preformatted text is the format that typed in the WML document.
This tag keeps all the white spaces included inside this tag. Let’s make a note that you are not putting this tag inside <p>...</p>
The <pre> element supports following attributes:
Attribute Value Description
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 <pre> element.
This will produce the following result:
wap-example7

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WML Topics