Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Mobile Themes

jQuery Mobile Themes

jQuery Mobile provides 2 different theme styles, from "a" to "b" - each theme has different colors for buttons, toolbars, content blocks, etc., and each theme has a different visual effect.

You can customize the appearance of the application by setting the data-theme attribute of elements:



按钮

Value Description Example
a The page has a gray background with black text
 头部与底部均为灰色背景黑色文字       

 按钮为灰色背景黑色文字       

 激活的按钮和链接为白色文本蓝色背景       

 input 输入框中 placeholder 属性值为浅灰色,value 值为黑色 | [尝试一下](/try/tryit.php?filename=tryjqmob_themes_a) |

| b | The page has a black background with white text
Both header and footer have a black background with white text
Buttons have white text on a charcoal background
Active buttons and links have white text on a blue background
The placeholder attribute value in the input box is light gray, and the value is white | Try it |

Button styling uses class="ui-btn"; use the "ui-btn-a|b" class to set the button to gray (default) or black:



按钮

lamp The "a" theme style is used for most elements, and child elements usually inherit the parent element's style.

Themed header and footer

Example

Try it »


Themed dialog header and footer

Example

 

 

Try it »


Theme buttons

Example

Black button

Try it »


Theme icons

Example

Search

Try it »


Themed popup

Example

Try it »


Themed buttons for header and footer

Example

  Home

 

Welcome to my homepage

  Search

  Follow me on Facebook

  Follow me on Twitter

  Follow me on Instagram

Try it »


Theme navbars

Example

 

Text header

 

   

 

Try it »


Themed panel

Example

Try it »


Theme collapsible buttons and content

Example

 

Click me - I'm collapsible!

 

I'm the expanded content.

Try it »


Theme lists

Example

Try it »


Theme split buttons

Example

    Try it »


    Theme collapsible lists

    Example

     

    Try it »


    Theme forms

    Example

    Try it »


    Theme collapsible forms

    Example

    Click me - I'm collapsible!

    Try it »


    Add a new theme

    jQuery Mobile can add new themes to mobile pages.

    Add or edit new themes by modifying the CSS file (if you have downloaded jQuery Mobile). You only need to copy the style module, then rename the letter class name (c-z), and add your favorite colors and fonts to the style.

    You can also add new theme styles in the HTML document: add the class ui-bar-(a-z) to toolbars, add the class ui-body-(a-z) to text content, and add the class ui-page-theme-(a-z) to pages.

    Example

    Try it »

    | Note | In previous versions of jQuery Mobile, JavaScript was used to inherit parent theme styles for elements. Since version 1.4, the framework focuses more on performance improvements and no longer uses JavaScript for inheritance, but instead uses pure CSS.

     jQuery Mobile 团队为此已经创建了一个工具,地址为 [ThemeRoller](http://themeroller.jquerymobile.com/)。你可以使用该工具来升级旧的主题,使其兼容新的版本。 |
    
    

    | --- | --- |