Skip to content

Instantly share code, notes, and snippets.

@arbales
Created September 22, 2010 19:29
Show Gist options
  • Star 58 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
  • Save arbales/592332 to your computer and use it in GitHub Desktop.
Save arbales/592332 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Checkbox</title>
<style>
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label
{
background: #999;
height: 16px;
width: 16px;
display:inline-block;
padding: 0 0 0 0px;
}
input[type=checkbox]:checked + label
{
background: #0080FF;
height: 16px;
width: 16px;
display:inline-block;
padding: 0 0 0 0px;
}
</style>
</head>
<body>
<p>
<input type='checkbox' name='thing' value='valuable' id="thing"/><label for="thing"></label>
</body>
</html>
@Moonbird-IT
Copy link

@v-bezborodov sorry for gravedigging but I think that's important to keep in mind: IDs are not meant to be duplicate anywhere in the same document. They are like fingerprints and shouldn't be present on different peoples' hands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment