Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                .artboard
	h1 GENDER
	label(class="switch")
		input(type="checkbox" onclick="check(this)")
		span(class="slider")
			span(class="btn")
				span(class="mouth")
				img(src="http://dev.dsgdsr.me/projects/codepen/tie.svg")

h2(class="gender") MALE

.footer
	Original Dribbble shot by 
	a(href="https://dribbble.com/shots/3371979-Gender-Toggle-Button" target="_blank") nasserui_
	span &nbsp;&nbsp;&middot;&nbsp;&nbsp; Code by 
	a(href="https://twitter.com/DSGDSRMC" target="_blank") DSGDSR
              
            
!

CSS

              
                *
	font-family: 'Roboto', sans-serif

body
	background: #9e9eff

h1
	font-size: 20px
	color: #fff
	text-align: center
	margin: 0 auto 30px auto

h2
	position: absolute
	font-weight: 800
	width: 99%
	margin: -55px auto
	color: rgba(255, 255, 255, 0.5)
	font-size: 55px
	text-align: center

.artboard
	width: 140px
	position: relative
	margin: 130px auto 60px

.switch
	position: relative
	display: inline-block
	width: 140px
	height: 68px
	margin: 0 auto
	& input
		display: none

.slider
	position: absolute
	cursor: pointer
	top: 0
	left: 0
	right: 0
	bottom: 0
	background-color: white
	transition: .4s
	border-radius: 34px
	box-shadow: 0px 0px 15px 0px rgba(0,0,0,0.24)
	& .btn
		box-sizing: border-box
		position: absolute
		height: 52px
		width: 52px
		left: 8px
		bottom: 8px
		background-color: #ffdde4
		transition: .4s
		border-radius: 50%
		border: 2px solid #9293ee
		&:after, &:before
			position: absolute
			content: ''
			top: 12px
			left: 12px
			background: #9293ee
			height: 7px
			width: 7px
			border-radius: 50%
		&:before
			top: 30px
		.mouth
			position: absolute
			top: 20px
			left: 30px
			width: 7px
			height: 7px
			background: transparent
			border-radius: 45%
			transform: rotate(45deg)
			border-top: 2px solid #9293ee
			border-right: 2px solid #9293ee
		img
			opacity: 0
			transition: all .5s
			position: absolute
			top: 35px
			left: -8px
			transform: rotate(45deg)
			width: 27px			
			
input
	&:checked + .slider
	&:focus + .slider
		box-shadow: 0 0 1px #2196F3
	&:checked + .slider > .btn
		transform: translateX(72px) rotate(180deg)
	&:checked + .slider img
		opacity: 1
	
	
.footer
	position: absolute
	width: 99%
	text-align: center
	color: #dcdcdc
	margin-top: 200px
	&>a
		color: #fff
		font-weight: 600
              
            
!

JS

              
                function check(obj){
  if (obj.checked) {
    $(".gender").html("FEMALE");
  } else {
    $(".gender").html("MALE");
  }
}; 
              
            
!
999px

Console