<html> Element

Preferences - Do not show ads

<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.


<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.


<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.


<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>


<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

Contents at a Glance
Print this Web Page | | Back to Top

Feedback Form (Expand)

What do you think about this web page?






XHTML MP Tutorial Table of Contents XHTML MP Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page