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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                .container
	#circle.closed
		.cross
	input#dash.closed
              
            
!

CSS

              
                =center($pos)
	position: $pos
	top: 50%
	left: 50%
	transform: translate(-50%, -50%)
*
	border: 0
	margin: 0
	padding: 0
	border-radius: 0
	box-sizing: border-box

html,
body
	background: #889
	height: 100vh
	width: 100%
	overflow: hidden

	.container
		+center(relative)
		width: 300px
		height: 300px
	
		#circle
			+center(relative)
			width: 50px
			height: 50px
			border: solid 4px #fff
			background: rgba(#fff, 0)
			border-radius: 50%
			cursor: pointer
			transition: all ease .3s
			.cross
				display: block
				position: absolute
				top: 50%
				right: 0
				z-index: 20
				width: 30px
				height: 30px
				cursor: pointer
				transform: translateY(-50%)
				&:before,
				&:after
					content: ''
					position: absolute
					display: block
					right: 7px
					height: 4px
					width: 4px
					border-radius: 1px
					transition: all .25s ease
				&:before
					top: 0px
					background-color: #889
					transform: rotate(-45deg)
					transform-origin: top right
					transition-delay: .1s
				&:after
					bottom: 0px
					background-color: #889
					transform: rotate(45deg)
					transform-origin: bottom right

			&.opened
				background: rgba(#fff, 1)
				transform: translate(-250%, -50%)
				.cross
					&:before,
					&:after
						width: 25px
						right: 13px
					&:before
						top: 5px
						transition-delay: .25s
					&:after
						bottom: 5px
						transition-delay: .3s
	
		#dash
			+center(absolute)
			height: 0px
			border-bottom: solid 4px #fff
			border-radius: 5px
			cursor: pointer
			padding-left: 5px
			transform-origin: left center
			transition: all ease .3s
			outline: rgba(#fff, 0)
			&.closed
				width: 25px
				transform: translate(1em, 1em) rotate(45deg)
			&.opened
				width: 200px
				height: 45px
				border-radius: 0
				transform: translate(-4.2em, -1.4em) rotate(0deg)	
              
            
!

JS

              
                const $ = document.querySelector.bind(document);
const searchItems = [$('#circle'), $('#dash')];
const search = () => searchItems.forEach(x => x.className === 'closed' ? x.className = 'opened' : x.className = 'closed');
searchItems[0].addEventListener('click', search);
															
              
            
!
999px

Console