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.


	<h1>Live region demo</h1>

<div aria-live="assertive"></div>

<div class="message">
	<header>Compose a message</header>
	<div class="content">


[aria-live="assertive"] {
	position: absolute;
	top: 0;
	width: max-content;
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;
	box-shadow: 0 2px 5px rgba(0,0,0,0.25);
	border-radius: 0 0 4px 4px;
	color: #fff;

[aria-live="assertive"]:not(:empty) {
	padding: .25em 1em;
	background: maroon;

/* general demo styles */
body {
	line-height: 1.6;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: #ddd;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
		"Segoe UI Symbol";

header {
	padding: 1rem 2rem;
	background: #fff;
	box-shadow: 0 2px 3px rgba(0,0,0,0.1);
	h1 {
		font-size: 1.2rem;
		margin: 0;

.message header {
	padding: 1rem;
	border-bottom: 1px solid #ccc;
	font-weight: 500;

.message footer {
	padding: 1rem;
	border-top: 1px solid #ccc;
	font-weight: 500;

.message {
	background: #fff;
	border: 1px solid #ddd;
	display: grid;
	grid-template-rows: auto 1fr auto;
	position: absolute;
	min-height: 60vh;
	width: 80vw;
	bottom: 0;
	right: 2vw;
	box-shadow: 0 0 7px 2px rgba(0,0,0,0.1);
	border-radius: 8px 8px 0 0;
	overflow: hidden;

button {
	background: #0871E7;
	color: #fff;
	padding: .2em 1em;
	border-radius: 4px;
	border: 1px solid transparent;
	font: inherit;
	&:focus-visible {
		outline: 2px solid black;
		outline-offset: 2px;


                const msg = document.querySelector('[aria-live="assertive"]');
const btn = document.querySelector('button');
const msgContent = "Message could not be sent. Check your network and try again.";

btn.addEventListener('click', function() {
	msg.innerHTML = '';
	msg.innerHTML = msgContent;
		msg.innerHTML = '';
	}, 4000)