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

              
                <div class="container">
	
	<h1>CSS Only Modal with Animation</h1> 
	
	<input id="modal" type="checkbox">
	<label class="modal-button" for="modal">
		<i class="fa fa-fire" aria-hidden="true"></i>
		<span>Fire Me!</span>
	</label>
	<label class="modal-background" for="modal"></label>

	<div class="modal-content">
		<label class="modal-close" for="modal">&#10005;</label>
		<h2>Sweet Modal</h2>
		<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
		<label class="modal-content-button" for="modal">OK</label>
	</div> <!-- .modal-content -->
</div> <!-- .modal-container -->

              
            
!

CSS

              
                $color-1: #16a085;
$color-2: #2980b9;
$light-black: #333;

html {
	color: $light-black;
	background-color: $color-1;
}

label {
	cursor: pointer;
	transition: all 250ms;
}

.container {
	position: relative;
	margin: 0 auto;
	padding: 50px;
	
	h1 {
		font-weight: 100;
		color: white;
		text-align: center;
	}
	
	.modal-button {
		position: relative;
		display: block;
		margin: 100px auto;
		padding: 20px 25px 34px;
		width: 50px;
		font-size: 36px;
		font-weight: 300;
		color: $color-2;
		text-align: center;
		line-height: 0.3;
		background-color: white;
		border-radius: 50%;
		box-shadow: 0 0 45px rgba(0,0,0,0.2);
		transition: all 250ms;
		
		span {
			font-size: 12px;
		}
		
		&:hover,
		&:focus {
			color: $color-1;
			box-shadow: 0 0 10px rgba(0,0,0,0.4);
		}
	}
	
	.modal-content,
	.modal-background {
		visibility: hidden;
		width: 0;
		height: 0;
		opacity: 0;
		overflow: hidden;
		cursor: pointer;
	}
	
	.modal-background {
		transition: height 250ms;
	}
	
	.modal-content {
		transform: scale(0);
		transition: transform 500ms;
	}
		
	#modal {
		display: none;
		
		&:checked ~ .modal-background {
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background-color: transparentize(black,0.2);
			visibility: visible;
			opacity: 1;
			transition: height 250ms;
		}
		
		&:checked ~ .modal-content {
			position: fixed;
			top: 50%;
			left: 50%;
			margin-top: -25%;
			margin-left: -25%;
			width: 50vw;
			height: auto;
			padding: 40px;
			background-color: white;
			border-radius: 3px;
			visibility: visible;
			opacity: 1;
			pointer-events: auto;
			cursor: auto;
			transform: scale(1);
			transition: transform 500ms;
			
			.modal-close {
				position: absolute;
				top: 20px;
				right: 20px;
				font-size: 22px;
				color: transparentize($light-black,0.6);
				transition: color 200ms,
						  transform 500ms;
				
				&:hover,
				&:focus {
					color: $light-black;
					transform: rotate(360deg);
				}
			}
			
			p {
				position: relative;
				margin: 0 0 20px 0;
				font-weight: 200;
				font-size: 14px;
				line-height: 1.6;
			}

			.modal-content-button {
				position: relative;
				float: right;
				margin: 0;
				padding: 10px 20px;
				color: white;
				font-weight: 100;
				border-radius: 3px;
				background-color: $color-2;
				
				&:hover,
				&:focus {
					background-color: lighten($color-2,10%);
				}
			}
		}
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console