jQuery Mobile has a rich theming system that gives you full control of how pages are styled. There is detailed theming documentation within each page widget, but let's look at a few high-level examples of how theming is applied.
The data-theme
attribute can be applied to the header and footer containers to apply any of the lettered theme color swatches. While the data-theme
attribute could be added to the content container, we recommend adding it instead to div
or container that has been assigned the data-role="page"
attribute to ensure that the background color is applied to the full page. When this is done, all widgets on the page will also inherit the theme specified in the page container. However, headers and footers will default to theme "a". If you want to have a page with, for example, only theme "b" for all its elements, including its header and footer, you will need to specify data-theme="b"
to the page div
as well as the header and footer divs
.
The default Theme mixes styles from multiple swatches to create visual texture and present the various elements in optimal contrast to one another:
This is the default content color swatch and a preview of a link.
ButtonAnd each of the five "swatches" applies its style consistently across all page elements, as shown below: