14. XHTML MP Preformatted Text

In XHTML MP, leading and trailing whitespaces of a paragraph is not displayed. Furthermore, two or more whitespaces in a paragraph are shown as one whitespace on the screen of mobile devices. This behavior is demonstrated in the following XHTML MP example.


(preformatEg1.xhtml)

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>XHTML MP Tutorial</title>
  </head>

  <body>
    <p> Hello, welcome
to
our
XHTML MP tutorial. </p>
  </body>
</html>



Sony Ericsson T610


Nokia Mobile Browser 4.0


To preserve the formatting of the text in XHTML MP, you have to use the <pre> element, like this example:


(preformatEg2.xhtml)

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>XHTML MP Tutorial</title>
  </head>

  <body>
    <pre> Hello, welcome
to
our
XHTML MP tutorial. </pre>
  </body>
</html>



Sony Ericsson T610





Nokia Mobile Browser 4.0


Previous Page Page 18 of 36 Next Page


A button for going back to the top of this page