O'Reilly logo

Real World XML by Steven Holzner

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

Setting Text Alignment

The <p> element has an align attribute, which is supported by Klondike and is useful for aligning text. You can assign this attribute the values "left", "center", or "right". There's also a mode attribute that you can use to specify whether you want text wrapped; you can assign values of "wrap" or "nowrap" to this attribute.

Here's an example that demonstrates text alignment, using these attributes of the <p> element:

Listing . ch20_08.wml
 
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 2.0//EN"
    "http://www.wapforum.org/dtd/wml20.dtd" >
<wml>
    <card id="Card1" title="Text Alignment">
        <p align="center"><b>Text Alignment</b></p>
					<p align="left">Left-aligned text</p>
					<p align="center">Center-aligned text</p> ...

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