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

jQuery UI Themes

jQuery UI Themes

All jQuery UI plugins allow developers to seamlessly integrate the look and feel of UI widgets into their websites or applications. Each plugin defines styles through CSS and contains two layers of style information: standard jQuery UI CSS Framework styles and plugin-specific styles.

The jQuery UI CSS framework provides semantic classes to indicate the roles of elements within a widget, such as headers, content, or clickable areas. These are consistent across all widgets; a clickable tab, accordion, or button all have the same ui-state-default class to indicate they are clickable. When the user hovers over these elements, this class becomes ui-state-hover, and when these elements are selected it becomes ui-state-active. The consistency of these classes makes elements with similar roles or interaction states look consistent across all widgets.

The CSS framework styles are encapsulated in a single file named ui.theme.css. This file is modified by the ThemeRoller application. The framework styles only contain properties that affect the look and feel, such as colors, background images, icons, etc. So these are "safe" styles that do not affect plugin functionality. This separation means developers can create a custom look and feel by modifying colors and images in the theme.css file. As future plugins or bug fixes become available, these work with themes without modification.

Since the framework styles only cover the look and feel, plugin-specific stylesheets must also be included. These stylesheets contain all the additional structural style rules that make widgets functional, such as size, padding, margins, positioning, and floats. Each plugin's stylesheet is located in the themes/base folder and is named after the plugin, for example "jquery.ui.accordion.css". These styles must be edited carefully, as they work with the script to provide overrides of the framework styles.

We encourage all developers to create jQuery plugins; the jQuery UI CSS framework makes it easier for end users to customize themes and use plugins.

Theming

The following are three general ways to theme jQuery UI plugins:

Using ThemeRoller, the jQuery UI CSS Framework, and Designing Custom Themes