A simple CSS on/off toggle switch checkbox.

View the Project on GitHub boazsender/mobilecheckbox


A simple CSS on/off toggle switch checkbox. Uses before and :checked psuedo selectors and the content property to make just a plain old simple <input type="checkbox"> look nice, provide greater affordance, and say "on" and "off". It looks like this:


Getting Started

Download the production version or the development version.

In your web page:

    <link rel="stylesheet" href="mobilecheckbox.css">
    <input type="checkbox">

Release History


Copyright (c) 2012 Boaz Sender
Licensed under the MIT, GPL licenses.


In lieu of a formal styleguide, take care to maintain the existing coding style. Lint your code using grunt and grunt-css.

Important notes

Please don't edit files in the dist subdirectory as they are generated via grunt. You'll find source code in the src subdirectory!

Installing grunt

This assumes you have node.js and npm installed already.

  1. Test that grunt is installed globally by running grunt --version at the command-line.
  2. If grunt isn't installed globally, run npm install -g grunt to install the latest version. You may need to run sudo npm install -g grunt.
  3. From the root directory of this project, run npm install to install the project's dependencies.