Skip to content

Instantly share code, notes, and snippets.

@duncanmcdougall
Created July 1, 2012 19:16
Show Gist options
  • Select an option

  • Save duncanmcdougall/3029298 to your computer and use it in GitHub Desktop.

Select an option

Save duncanmcdougall/3029298 to your computer and use it in GitHub Desktop.
iOS switch styled check boxes
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<style>
body
{
margin:40px;
}
input[type="checkbox"]
{
position:absolute;
left:-9999px;
top:-9999px;
}
label
{
display:block;
width:77px;
height:27px;
background: url('http://s11.postimage.org/rxp1lfdc3/switch.png') right center no-repeat;
background-size:128px 27px;
border-radius:14px;
transition: background-position 0.2s;
-webkit-transition: background-position 0.2s;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
}
input[type="checkbox"]:checked+label
{
background-position:left center;
}​
</style>
</head>
<body>
<input type="checkbox" id="cb" />
<label for="cb"></label>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment