8.4. Universal Selector

The universal selector is the * character. It selects all tags in an XHTML MP document. The following XHTML MP/WCSS example demonstrates the usage of the universal selector in cascading style sheets.


(universalSelectorEg1.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">
      * {
        color: blue
      }
    </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>


In the above example, the WAP CSS style rule "color: blue" is applied to all tags. So, all text (except the title. Note: WAP CSS styles cannot be applied to the <title> tag) and the horizontal rule will be rendered in blue color. The screenshots of the example in mobile phone emulators is shown below.






Sony Ericsson T610





Nokia Mobile Browser 4.0


Using universal selectors in cascading style sheets can slow down the rendering of a WAP page on some WAP browsers (e.g. Openwave Mobile Browser 6.x). You should check your WAP page on real mobile devices to ensure the performance loss is not significant.


Previous Page Page 10 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