Skip to content

Instantly share code, notes, and snippets.

@rapidrapids
Created August 6, 2012 09:01
Show Gist options
  • Save rapidrapids/3272411 to your computer and use it in GitHub Desktop.
Save rapidrapids/3272411 to your computer and use it in GitHub Desktop.
Checkbox hack with FontAwesome
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="style/stylesheets/main.1.0.0.0.css" />
<style>
.input-checkbox-alt {
opacity: 0;
position: absolute;
z-index: 5;
}
.input-checkbox-alt + label {
cursor: pointer;
display: inline;
margin-left: 23px;
}
.input-checkbox-alt + label:before {
color: #bbb;
content: "\f058";
cursor: pointer;
font: 17px/1em FontAwesome;
margin-left: -23px;
padding-right: 4px;
vertical-align: middle;
}
.input-checkbox-alt:checked + label { color: #444; }
.input-checkbox-alt:checked + label:before { color: green; }
</style>
</head>
<body>
<p>
<input type="checkbox" id="happy-checkbox" class="input-checkbox-alt" name="happy">
<label for="happy-checkbox">I am happy</label>
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment