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 jqxButtons.
-
jqxCheckBox Style
- jqx-widget - applied to jqxCheckBox widget.
- jqx-checkbox - applied to jqxCheckBox's outer div element.
- jqx-checkbox-default - applied to the check box when its state is default.
- jqx-fill-state-normal - applied to the check box when its state is default.
- jqx-checkbox-hover - applied to the check box when the mouse cursor is over it
- jqx-fill-state-hover - applied to the check box when the mouse cursor is over it
- jqx-checkbox-disabled -applied to the check box when the widget is disabled
- jqx-checkbox-disabled-box - applied to the check's box when the jqxCheckBox is disabled.
- jqx-checkbox-check-checked - applied to the check's box when the jqxCheckBox is
checked. Displays a check icon
- jqx-checkbox-check-disabled - applied to the check's box when the jqxCheckBox is
disabled. Displays a disabled check icon
- jqx-checkbox-check-indeterminate - applied to the check's box when the jqxCheckBox
is in indeterminate state. Displays a rectangle inside the check's box.
- jqx-checkbox-check-indeterminate-disabled - applied to the check's box when the
jqxCheckBox is in indeterminate state and the jqxCheckBox is disabled. Displays
a gray(disabled) rectangle inside the check's box.
- jqx-fill-state-disabled - applied to the jqxCheckBox when it is disabled.
- jqx-fill-state-focus - applied to the jqxCheckBox when it is focused.
When you create a custom style with colors and backgrounds for jqxCheckBox, you
need to do the following:
- Add the above CSS classes related to jqxButtons
- After each CSS class, add your theme name.
For example:
jqx-checkbox-shinyblack
- To apply your custom style to jqxCheckBox, you need to set its 'theme' property(option)
to point to your theme name string.
$("#jqxcheckbox").jqxCheckBox({ theme: 'shinyblack', width: 120, height: 25 });
- The sample below demonstrates how to set the 'Shiny Black' theme to jqxCheckBox.
<!DOCTYPE html><html lang="en"><head> <title id='Description'>jQuery CheckBox CSS Styling Sample</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/jqxcheckbox.js"></script> <script type="text/javascript"> $(document).ready(function () { // create jqxCheckBox. $("#jqxcheckbox").jqxCheckBox({ width: 120, height: 25, theme: 'shinyblack' }); }); </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 class='default'> <div id='jqxcheckbox'> Click me</div></body></html>