Wml-formatting
WML-フォーマット
このセクションでは、WMLの基本的なテキストフォーマット要素について説明します。
改行:
<br/>要素は改行を定義し、ほとんどすべてのWAPブラウザは改行タグをサポートしています。
<br/>要素は、次の属性をサポートしています。
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. |
以下は、<br/>要素の使用法を示す例です。
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card title="Line Break Example">
<p align="center">
This is a <br/> paragraph with a line break.
</p>
</card>
</wml>
これにより、次の結果が生成されます。
テキスト段落:
<p>要素はテキストの段落を定義し、WAPブラウザーは常に新しい行で段落をレンダリングします。
WMLでテキスト、画像、またはテーブルを定義するには、<p>要素が必要です。
<p>要素は、次の属性をサポートしています。
Attribute | Value | Description |
---|---|---|
align |
|
This is used to change the horizontal alignment of a paragraph. |
mode |
|
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. |
以下は、<p>要素の使用法を示す例です。
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card title="Paragraph Example">
<p align="center">
This is first paragraph
</p>
<p align="right">
This is second paragraph
</p>
</card>
</wml>
これにより、次の結果が生成されます。
WMLテーブル:
<tr>および<td>とともに<table>要素を使用して、WMLでテーブルを作成します。 WMLはテーブルのネストを許可しません
<table>エレメントは、<p> … </p>エレメントと一緒に配置する必要があります。
<table/>要素は、次の属性をサポートしています。
Attribute | Value | Description |
---|---|---|
columns | number | Sets the number of columns in the table |
align |
a |
列の水平方向のテキスト配置を指定するには、align属性に3文字を割り当てる必要があります。 各文字は、列の水平方向のテキスト配置を表します。 文字はL、C、またはRのいずれかです。 たとえば、次の設定をテーブルに適用する場合:
次に、_align_属性の値を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. |
以下は、<table>要素の使用方法を示す例です。
<?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>
これにより、次の結果が生成されます。
書式設定済みのテキスト:
<pre>要素は、WMLで事前にフォーマットされたテキストを指定するために使用されます。 事前にフォーマットされたテキストとは、WMLドキュメントで入力された形式に従ってフォーマットされたテキストです。
このタグは、このタグで囲まれたすべての空白を保持します。 このタグを<p> … </p>の中に入れていないことを確認してください
<pre>要素は、次の属性をサポートしています。
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. |
以下は、<pre>要素の使用法を示す例です。
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card title="Preformatted Text">
<pre>
This is preformatted
text and will appear
as it it.
</pre>
</card>
</wml>
これにより、次の結果が生成されます。