cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="container clearfix">
		<h1>Custom checkbox and radio button <br /> with font awesome</h2>
	<div class="half-col">
				<header>Checkbox</header>
				<form>
						<ul>
								<li>
										<label>
												<input type="checkbox" />
												<span class="lbl padding-8">First checkbox</span>
										</label>
								</li>
								<li>
										<label>
												<input type="checkbox" />
												<span class="lbl padding-8">Second checkbox</span>
										</label>
								</li>
								<li>
										<label>
												<input type="checkbox" disabled />
												<span class="lbl padding-8">Disabled Chekcbox</span>
										</label>
								</li>
								<li>
										<label>
												<input type="checkbox" checked disabled />
												<span class="lbl padding-8">Checked and Disabled</span>
										</label>
								</li>
						</ul>
				</form>
		</div>

		<div class="half-col last">
				<header>Radio button</header>
				<form>
						<ul>
								<li>
										<label>
												<input type="radio" name="radio" />
												<span class="lbl padding-8">First option</span>
										</label>
								</li>
								<li>
										<label>
												<input type="radio" name="radio" />
												<span class="lbl padding-8">Second option</span>
										</label>
								</li>
								<li>
										<label>
												<input type="radio" name="radio" disabled />
												<span class="lbl padding-8">Disabled Radio button</span>
										</label>
								</li>
								<li>
										<label>
												<input type="radio" name="radio" checked disabled />
												<span class="lbl padding-8">Checked and Disabled</span>
										</label>
								</li>
						</ul>
				</form>
		</div>
</div>
            
          
!
            
              body {
		font-family: 'Source Sans Pro', sans-serif;
		font-size: 14px;
		color: #666;
}

h1 {
		text-align: center;
		margin-top: 40px;
}

.container {
		width: 600px;
		margin: 40px auto;
}

.container header {
		margin-bottom: 10px;
		padding: 10px 20px;
		border-bottom: 1px solid #DDD;
		background: #f4f4f4;
}

.half-col {
		border: 1px solid #DDD;
		float: left;
		width: 45%;
		margin-right: 5%;
		box-shadow: 0 3px 0 #EEE;
}

.half-col.last {
		width: 45%;
		margin-right: 0;
}

.half-col ul {
		list-style: none;
		padding-left: 20px;
}

.half-col li {
		overflow: hidden;
		display: block;
		margin-bottom: 10px;
}

input[type=checkbox],
input[type=radio] {
		opacity: 0;
		position: absolute;
		z-index: 12;
		width: 18px;
		height: 18px;
}

input[type=checkbox]:checked,
input[type=radio]:checked,
input[type=checkbox]:focus,
input[type=radio]:focus {
		outline: none !important;
}

input[type=checkbox]+.lbl,
input[type=radio]+.lbl {
		position: relative;
		z-index: 11;
		display: inline-block;
		margin: 0;
		line-height: 20px;
		min-height: 14px;
		min-width: 14px;
		font-weight: normal;
}

input[type=checkbox]+.lbl.padding-16::before,
input[type=radio]+.lbl.padding-16::before {
		margin-right: 16px;
}

input[type=checkbox]+.lbl.padding-12::before,
input[type=radio]+.lbl.padding-12::before {
		margin-right: 12px;
}

input[type=checkbox]+.lbl.padding-8::before,
input[type=radio]+.lbl.padding-8::before {
		margin-right: 8px;
}

input[type=checkbox]+.lbl.padding-4::before,
input[type=radio]+.lbl.padding-4::before {
		margin-right: 4px;
}

input[type=checkbox]+.lbl.padding-0::before,
input[type=radio]+.lbl.padding-0::before {
		margin-right: 0px;
}

input[type=checkbox]+.lbl::before,
input[type=radio]+.lbl::before {
		font-family: fontAwesome;
		font-weight: normal;
		font-size: 11px;
		color: #2091cf;
		content: "\a0";
		background-color: #FAFAFA;
		border: 1px solid #CCC;
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
		border-radius: 0;
		display: inline-block;
		text-align: center;
		vertical-align: middle;
		height: 13px;
		line-height: 13px;
		min-width: 13px;
		margin-right: 1px;
		margin-top: -5px;
}

input[type=checkbox]:checked+.lbl::before,
input[type=radio]:checked+.lbl::before {
		display: inline-block;
		content: '\f00c';
		background-color: #F5F8FC;
		border-color: #adb8c0;
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05), inset 15px 10px -12px rgba(255, 255, 255, 0.1);
}

input[type=checkbox]:hover+.lbl::before,
input[type=radio]:hover+.lbl::before,
input[type=checkbox]+.lbl:hover::before,
input[type=radio]+.lbl:hover::before {
		border-color: #1c7aad;
}

input[type=checkbox]:active+.lbl::before,
input[type=radio]:active+.lbl::before,
input[type=checkbox]:checked:active+.lbl::before,
input[type=radio]:checked:active+.lbl::before {
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px 1px 3px rgba(0, 0, 0, 0.1);
}

input[type=checkbox]:disabled+.lbl::before,
input[type=radio]:disabled+.lbl::before,
input[type=checkbox][disabled]+.lbl::before,
input[type=radio][disabled]+.lbl::before,
input[type=checkbox].disabled+.lbl::before,
input[type=radio].disabled+.lbl::before {
		background-color: #DDD !important;
		border-color: #CCC !important;
		box-shadow: none !important;
		color: #BBB;
}

input[type=radio]+.lbl::before {
		border-radius: 32px;
		font-family: Arial, Helvetica, sans-serif;
		font-size: 36px;
}

input[type=radio]:checked+.lbl::before {
		content: "\2022";
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console