Incorporating Line Breaks with the BR Element

Another WML element that allows you to define the look of text is the BR element. This element forces the insertion of a line break into the text.

Unlike most WML elements, the BR element contains no starting or ending tag. The BR element is an empty-element tag. In other words, a line break is created by simply inserting <br/> into the text whenever you want a new line of text to start.

The BR element is easy to use and contains no attributes. To see how the BR element works, type the following code into a text editor. Then, save it as break.wml, and run it from a device-emulator. Figure 4.4 shows this file on a device screen:

Figure 4.4. The break.wml file on a device screen.

 1 <?xml version="1.0"?> ...

Get WAP 2.0 Development 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.