Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


Auto Save

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.


                <div class="container">
	<h1>Click to open Popup</h1>
	<button id="openMyPopup" data-popup="myPopup" onClick="openPopup('#myPopup')" aria-controls="myPopup" aria-label="Open popup">Open</button>

<div class="popup" id="myPopup" aria-hidden="true" onClick="if( == this){closePopup('#myPopup');}">
	<div class="wrapper" aria-labelledby="popupTitle" aria-describedby="popupText" aria-modal="true">
		<h2 id="popupTitle">This is my Popup</h2>
		<p id="popupText">Lorem ipsum dolor sit amet consectetur, adipiscing elit lacinia mus, sapien nibh imperdiet tempus. Vitae massa semper mi sagittis a cum cursus fusce per, gravida tellus metus purus litora nam ultricies donec, nibh dis ligula ad facilisi penatibus condimentum aenean.</p>
		<button id="closePopup" onClick="closePopup('#myPopup');" aria-label="Close popup">Close</button>


                $btn-color: #9AD3DE;

html, body {
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
	position: relative;
	text-align: center;

body {
	display: flex;
	align-items: center;
	.container {
		width: 100%;
		height: auto;
		margin: 0 auto;

h1, h2, p, button {
	font-family: 'Montserrat', cursive;
	font-weight: 100;

p, button {
	font-weight: 300;

h1 {
	font-size: 40px;

h2 {
	font-size: 45px;

h1, h2 {
	text-align: center;
	color: #666666;
	margin: 0 0 30px 0;

p {
	color: #666666;
	line-height: 1.5;

button {
	background: $btn-color;
	border: 0;
	border-radius: 4px;
	padding: 15px 30px;
	font-size: 18px;
	color: #FFFFFF;
	cursor: pointer;

	&:focus {
		outline: none;

	&:hover {
		background: lighten($btn-color, 10%);

.popup {
	background: rgba(100, 100, 100, 0.6);
	position: fixed;
	display: none;
	z-index: 9999;
	height: 100%;
	width: 100%;
	left: 0;
	top: 0;

	.wrapper {
		max-width: 600px; // Max-width of popup can be changed
		width: 70%; // Width of popup
		position: fixed;
		transform: translate(-50%, -50%);
  		left: 50%;
	   top: 50%;
		background: #FFFFFF;
		padding: 30px;
		border-radius: 10px;
		box-shadow: 2px 2px 10px 0px rgba(#000000, 0.4);


                function openPopup(popup) {
	/* Open popup and make accessible screen readers */
	$(popup).show().attr("aria-hidden", "false");
	/* Focus on element to guide screen readers to popup */

function closePopup(popup) {
	/* Close popup and hide from screen readers */
	$(popup).hide().attr("aria-hidden", "true");
	/* Focus screen readers back to button */