Pen Settings



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


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


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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.


                <link href="//" media="only all and (min-width: 640px) and (max-width: 980px)" rel="stylesheet" type="text/css" />
	<link href="//" media="only all and (min-width: 980px)" rel="stylesheet" type="text/css" />

<section><div class="global-alert">
  <div class="header">
    <h2><a href="/emergency/">Emergency alert</a></h2>
    <time datetime="2014-10-20T12:30:00+10:00">about 3 minutes ago</time>

  <div class="summary">
      <a href="">Tropical Cyclone Nathan</a>

<section id="code">
  <h2>Grab the HTML!</h2>
<pre><code id="output" class="html"></code></pre>

<section id="form">
<h2>Edit global alert</h2>
<form class="form">
  <ol class="questions">
      <label for="h2">
        <span class="label">H2 heading</span>
        <abbr title="(required)">*</abbr>
      <input type="text" id="h2" size="40" required list="h2-datalist" value="Weather alert">
      <label for="summary">
        <span class="label">P summary</span>
        <abbr title="(required)">*</abbr>
      <input type="text" id="summary" size="40" required placeholder="Tropical Cyclone Nathan" value="Tropical Cyclone">
    <li class="atomic group">
          <span class="label">Timestamp</span>
          <abbr title="(required)">*</abbr>
        <ol class="questions compact">
            <label for="date">
              <span class="label">Date</span>
            <input type="date" id="date" required>
            <label for="time">
              <span class="label">Time (in Queensland)</span>
            <input type="time" id="time" required>
      <label for="url">
        <span class="label">Web address</span>
        <abbr title="(required)">*</abbr>
      <input type="text" id="url" value="" required size="40">

<datalist id="h2-datalist">
  <option>Weather alert</option>
  <option>Emergency alert</option>


                body {
  padding: 1em 5em;
  background: #fafafa; 

#code {
  float: right;
  width: 50%;
#form {
  float: left;
  width: 50%;


                var NOW = new Date();
var date = $( '#date' );
var time = $( '#time' );

// initial values
date[ 0 ].value = NOW.toISOString().replace( /T.*$/, '' );
time[ 0 ].value = NOW.toTimeString().replace( /:[^:]*$/, '' );

// update HTML
function updateGlobalAlert() {
  $( 'h2 > a', '.global-alert' ).text( $( '#h2' ).val() );
  $( 'a', '.global-alert > .summary' ).text( $( '#summary' ).val() );
  $( 'a', '.global-alert' ).attr( 'href', $( '#url' ).val() );
  var timestamp = new Date( date.val() + 'T' + time.val() + ':00+10:00' );
  $( 'time', '.global-alert' ).text( moment( timestamp ).format( 'D MMMM YYYY' ));
  $( 'time', '.global-alert' ).attr( 'datetime', timestamp.toISOString() );

	$( '#output' ).text( $( '.global-alert' ).parent().html() );

$( 'pre code' ).each(function( i, block ) {
    hljs.highlightBlock( block );

// onload

// onchange
$( 'input' ).on( 'change input', updateGlobalAlert );