O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The <br> Element

The <br> element is one of the simplest in WML. It takes no attributes and is always specified as an empty-element tag, <br/>. It marks a line break in a paragraph of text: when the browser encounters a <br/>, it starts a new line.

You may ask what the difference is between using a <br/> to break lines:

<p>text<br/>more text</p>

and using another paragraph:

<p>text</p><p>more text</p>

The answer is that WAP doesn’t specify the difference. Some browsers insert a small amount of blank space between paragraphs, but won’t do this at a <br/>, but not all browsers actually make a distinction at all. Note that if you need to change the alignment or wrapping mode of the text, you have to use a <p>, since the <br/> tag can’t specify these attributes.

A good rule of thumb is to use <p> where the text naturally breaks into blocks, just like the paragraphs in normal text. Use <br/> where you want a break for presentation, but the text continues with part of the same block afterward. For example, when putting normal paragraphs of text into a deck, use one <p> element for each paragraph:

<p>
    A good rule of thumb is to use &lt;p&gt; where the
    text naturally breaks into blocks, just like the
    paragraphs in normal text. Use &lt;br/&gt; where
    you want a break for presentation, but the text
    continues with part of the same block afterward.
</p>
<p>
    For example, when putting normal paragraphs of
    text into a deck, use one &lt;p&gt; element for
    each paragraph:
</p>

When entering something like ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required