7.2. Place WCSS Styles at the Document Head (Internal Style Sheet)

The <style> element is used to place WCSS styles at the document head of an XHTML MP document. A style sheet defined in this way is called an internal style sheet or a document-level style sheet. WCSS styles of an internal style sheet apply only to the XHTML MP document that they are located in. WCSS statements are enclosed in the <style></style> tag pair. The syntax is like this:


<style type="text/css">
  some WCSS statements
</style>


The type attribute of <style> specifies the MIME type of the cascading style sheet.

This XHTML MP/WAP CSS example shows how to place an internal style sheet at the document head:


(internalWCSSEg1.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>
    <style type="text/css">
      hr {
        color: blue
      }

      p {
        font-style: italic
      }

      h1 {
        color: white;
        background-color: black
      }
    </style>
    <title>WCSS Tutorial</title>
  </head>

  <body>
    <h1>Table of Contents</h1>
    <hr/>
    <p>
      WCSS Tutorial Chapter 1<br/>
      WCSS Tutorial Chapter 2<br/>
      WCSS Tutorial Chapter 3<br/>
    </p>
  </body>
</html>


The result of the above XHTML MP/WAP CSS example in some mobile phone browsers is shown below:






Sony Ericsson T610





Nokia Mobile Browser 4.0


Previous Page Page 5 of 39 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