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

              
                <a href="#" class='btn open-modal' data-modal="#modal1">Open Modal</a>

<div class='modal' id='modal1'>
	<div class='content'>
		<h1 class='title'>This is a modal</h1>
		<p>
				Here is some text and stuff. cool cool	
		</p>
		<a class='btn close-modal' data-modal="#modal1" href="#">K Bye</a>
	</div>	
</div>	
              
            
!

CSS

              
                $red: #EF233C
$blue: #2B2D42
$orange: #FF9F1C

*
	box-sizing: border-box

body
	font-family: 'Nunito', sans-serif
	min-height: 100vh
	display: flex
	justify-content: center
	align-items: center

.btn
	padding: 20px 50px
	display: inline-block
	background: $red
	color: white
	text-decoration: none
	transition: 0.35s ease-in-out
	font-weight: 700
	&:hover
		background: darken($red, 7.5%)

.overlay
	width: 100%
	min-height: 100vh
	display: flex
	justify-content: center
	align-items: center
	flex-direction: column
	padding: 40px
	position: fixed
	top: 0
	left: 0
	background: rgba(black, 0.75)
	opacity: 0
	pointer-events: none
	transition: 0.35s ease-in-out
	max-height: 100vh
	overflow-y: auto
	&.open
		opacity: 1
		pointer-events: inherit
	.modal
		background: white
		text-align: center
		padding: 40px 80px
		box-shadow: 0px 1px 10px rgba(white, 0.35)
		opacity: 0
		pointer-events: none
		transition: 0.35s ease-in-out
		max-height: 100vh
		overflow-y: auto
		&.open
			opacity: 1
			pointer-events: inherit
			.content
				transform: translate(0, -0px)
				opacity: 1
		.content
			transform: translate(0, -10px)
			opacity: 0
			transition: .35s ease-in-out
		.title
			margin-top: 0


              
            
!

JS

              
                $(".modal").each( function(){
	$(this).wrap('<div class="overlay"></div>')
});

$(".open-modal").on('click', function(e){
	e.preventDefault();
	e.stopImmediatePropagation;
	
	var $this = $(this),
			modal = $($this).data("modal");
	
	$(modal).parents(".overlay").addClass("open");
	setTimeout( function(){
		$(modal).addClass("open");
	}, 350);
	
	$(document).on('click', function(e){
		var target = $(e.target);
		
		if ($(target).hasClass("overlay")){
			$(target).find(".modal").each( function(){
				$(this).removeClass("open");
			});
			setTimeout( function(){
				$(target).removeClass("open");
			}, 350);
		}
		
	});
	
});

$(".close-modal").on('click', function(e){
	e.preventDefault();
	e.stopImmediatePropagation;
	
	var $this = $(this),
			modal = $($this).data("modal");
	
	$(modal).removeClass("open");
	setTimeout( function(){	
		$(modal).parents(".overlay").removeClass("open");
	}, 350);
	
});	
              
            
!
999px

Console