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 jqxComboBox.- jqx-widget - applied to the jqxComboBox widget.
- jqx-combobox-content - applied to the jqxComboBox's content which displays the text.
- jqx-widget-content - applied to the jqxComboBox's content which displays the text.
- jqx-combobox-input - applied to the ComboBox's input field.
- jqx-combobox-content-disabled - applied to the ComboBox's content when the widget is disabled.
- jqx-combobox-arrow-normal - applied to the ComboBox's arrow button.
- jqx-combobox-arrow-hover - applied to the ComboBox's arrow button when the mouse is over the button.
- jqx-combobox-arrow-selected - applied to the ComboBox's arrow button when the ComboBox's popup is opened.
- jqx-combobox-state-normal - applied to the ComboBox in normal state.
- jqx-fill-state-normal - applied to the ComboBox in normal state.
- jqx-combobox-state-hover - applied to the ComboBox when the mouse is over the widget.
- jqx-fill-state-hover - applied to the ComboBox when the mouse is over the widget.
- jqx-combobox-state-selected - applied to the ComboBox when the popup ListBox is shown.
- jqx-fill-state-pressed - applied to the ComboBox when the popup ListBox is shown.
- jqx-fill-state-focus - applied to the combobox when it is focused.
- jqx-fill-state-disabled - applied to the combobox when it is disabled.
When you create a custom style with colors and backgrounds for jqxComboBox, you need to do the following:
- Add the above CSS classes related to jqxComboBox
- After each CSS class, add your theme name.
For example:
jqx-combobox-summer - To apply your custom style to jqxComboBox, 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 jqxComboBox $("#jqxcombobox").jqxComboBox({ source: source, selectedIndex: 0, width: '200px', height: '25px', theme: 'summer' }); });</script>
- The sample below demonstrates how to set the 'Summer' theme to jqxComboBox.
<!DOCTYPE html><html lang="en"><head> <title>jQuery ComboBox CSS Styling and Appearance</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.shinyblack.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/jqxcombobox.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 jqxComboBox $("#jqxComboBox").jqxComboBox({ source: source, selectedIndex: 0, width: '200px', height: '25px', theme: 'shinyblack' }); }); </script> <div id='jqxComboBox'> </div> </div></body></html>