7.4. <html> Element

<html> is the root element of XHTML MP. All other elements should be enclosed within the <html></html> tags.

The xmlns attribute is used to define the namespace for XHTML MP. Currently only the value "http://www.w3.org/1999/xhtml" can be assigned to the xmlns attribute. You must include the xmlns attribute in order to conform strictly to the XHTML MP standard, although currently most WAP browsers will still display the XHTML MP page correctly even if the xmlns attribute is missing.


7.5. <head> Element

The <head> and </head> tags are used to specify the start and the end of the document head respectively. Information about the document is placed in the document head. The <head> element is used as a container for other elements such as <title> and <link>. The <title> element and the <link> element are used to specify the title of the XHTML MP document and the URL to the external cascading style sheet respectively. Metadata of the XHTML MP document is also placed in the document head. Metadata is specified using the <meta> element.


7.6. <title> Element

The <title> element is used to specify the title of an XHTML MP page. This element should be enclosed within the <head></head> tag pair. Most WAP browsers will display the title at the top of the screen. If the title is too long, WAP browsers will truncate the title to match the size of the title bar. WAP CSS styles cannot be used with the <title> element.


7.7. <body> Element

The <body> element is used as a container for the actual content. An XHTML MP file can only contain one <body> element, which means the deck and card concept of WML 1.x is not supported any more.

Text cannot be enclosed directly in the <body></body> tag pair. For example, the following markup code is incorrect in XHTML MP:


<body>
  Hello world. Welcome to our XHTML MP tutorial.
</body>


To correct the above XHTML MP markup code, the text in the document body must be enclosed in some other elements such as paragraphs (<p></p>), lists (<ul><li></li></ul> or <ol><li></li></ol>), headings (<h1></h1>, <h2></h2>...), etc. The following markup code is correct in XHTML MP:


<body>
  <p>Hello world. Welcome to our XHTML MP tutorial.</p>
</body>


7.8. <p> Element

The <p> element is used to enclose a paragraph of text. Besides text, things such as anchor links and images can be included in the <p> element. WAP browsers always render a paragraph on a new line.

In HTML and WML 1.x, you can make use of the align attribute of the <p> element to change the horizontal alignment of a paragraph. Note that the align attribute has been removed in XHTML MP. To change the horizontal alignment of a paragraph of text in XHTML MP, you have to use the WAP CSS text-align property. For example, if you put the following WAP CSS style statement in your XHTML MP page's external style sheet, text in all paragraphs will be aligned to the right.


p {
  text-align: right
}


Previous Page Page 11 of 36 Next Page


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page