Documentation

Styling and Appearance

jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file.

Below is the list of CSS classes used by jqxDropDownList.
  • jqx-widget - applied to the dropdownlist.
  • jqx-dropdownlist-content - applied to the dropdownlist's content element which displays the selected item's text or html.
  • jqx-dropdownlist-content-disabled - applied to the dropdownlist's content element which displays the selected item's text or html and the widget is disabled.
  • jqx-dropdownlist-state-normal - applied to the dropdownlist in default state.
  • jqx-fill-state-normal - applied to the dropdownlist in default state.
  • jqx-dropdownlist-state-hover - applied to the dropdownlist in hovered state.
  • jqx-fill-state-hover - applied to the dropdownlist in hovered state.
  • jqx-dropdownlist-state-selected - applied to the dropdownlist in selected state.
  • jqx-fill-state-pressed - applied to the dropdownlist in selected state.
  • jqx-dropdownlist-state-disabled - applied to the dropdownlist in disabled state.
  • jqx-fill-state-focus - applied to the dropdownlist when it is focused.
  • jqx-fill-state-disabled - applied to the dropdownlist when it is disabled.
*jqxDropDownList internally use the jqxListBox widget. For additional information about styling jqxListBox, please take a look at the jqxListBox's Styling and Appearance help topic.

When you create a custom style with colors and backgrounds for jqxDropDownList, you need to do the following:
  • Add the above CSS classes related to jqxDropDownList
  • After each CSS class, add your theme name.
    For example:
    jqx-dropdownlist-summer
  • To apply your custom style to jqxDropDownList, you need to set its 'theme' property(option) to point to your theme name string.
    <script type="text/javascript">
    $(document).ready(function () {
    var source = [
    "Affogato"
    ];
    // Create a jqxDropDownList
    $("#jqxdropdownlist").jqxDropDownList({ source: source, selectedIndex: 0, width: '200px', height: '25px', theme: 'summer' });
    });
    </script>
  • The sample below demonstrates how to set the 'Summer' theme to jqxDropDownList.
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>jQuery DropDownList CSS Styling Sample</title>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.summer.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head>
    <body>
    <div id='content'>
    <script type="text/javascript">
    $(document).ready(function () {
    var source = [
    "Affogato",
    "Americano",
    "Bicerin",
    "Breve",
    "Café Bombón",
    "Café au lait",
    "Caffé Corretto",
    "Café Crema",
    "Caffé Latte",
    ];
    // Create a jqxDropDownList
    $("#jqxDropDownList").jqxDropDownList({ source: source, selectedIndex: 0, width: '200px', height: '25px', theme: 'summer' });
    });
    </script>
    <div id='jqxDropDownList'>
    </div>
    </div>
    </body>
    </html>