Theme Inheritance

Description

Components can inherit the themes of their parent containers.

Example

In the following code we styled our page container with data-theme="e". As a result, the content theme is inheriting the "e" theme from its parent container.


<!DOCTYPE html>
<html>
<head>
<meta name="viewport"
  content="width=device-width, minimum-scale=1, maximum-scale=1">
<link rel="stylesheet"
  href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<style>
label {<!--from   ww  w  . ja va  2s .c  o  m-->
  float: left;
  width: 5em;
}

input.ui-input-text {
  display: inline !important;
  width: 10em !important;
}

form p {
  clear: left;
  margin: 1px;
}
</style>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head>
<body>
  <div data-role="page" data-theme="e">
    <div data-role="header">
      <h1>No inheritance</h1>
    </div>
    <div data-role="content" style="text-align: center; margin-top: 5px;">
      Inherits "e"

      <ul data-role="listview" data-inset="true">
        <li data-role="list-divider">No inheritance</li>
        <li>No inheritance</li>
        <li>No inheritance</li>
      </ul>

      <form id="test" id="test" action="#" method="post">
        <p>
          <label for="text">Inherits "e"</label>
          <input type="text" name="text" id="text" value="" placeholder="Text input" />
        </p>
        <p>
          <label for="sound">Inherits "e"</label>
          <select name="slider"
            id="sound" data-role="slider">
            <option value="off">Off</option>
            <option value="on">On</option>
          </select>
        </p>

        <a href="#" data-role="button">Button (Inherits "e")</a>
      </form>
    </div>
    <div data-role="footer" data-position="fixed">
      <h3>No inheritance</h3>
    </div>
  </div>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Tutorial »




jQuery_Mobile
Form
List
Layout
Theme