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.

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 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.


                <div class="container">
  <h1>Live edits<!-- or other events! --> to all Wikimedia wikis </h1>
  <em><a href="">Documentation</a></em>
  <span hidden>Messages in the last second: <span id="rate-min">..</span> (average so far: <span id="rate-avg">..</span>/s)</span>
  <div class="alert alert-warning">The stream/v1 API ("RCStream") has been deprecated in favor of stream/v2 ("EventStreams"), also available at <a href=""></a>.</div>
  <div class="alert alert-danger">The stream/v1 API was shutdown in July 2017. See <a href=""></a> for an updated CodePen demo.</div>
  <pre id="feed" class="mw-feed" hidden></pre>
<footer class="mw-footer" role="contentinfo">
	<div class="container">
		<p>Created by <a href="">@Krinkle</a>.</p>


.mw-footer {
	padding-top: 40px;
	padding-bottom: 40px;
	margin-top: 100px;
	background: #f9f9f9;
	color: #777;
	text-align: center;
	border-top: 1px solid #e5e5e5


                (function() {
  // See
  var socket = io.connect('');
  var feedNode = document.getElementById('feed');
  var rateMinNode = document.getElementById('rate-min');
  var rateAvgNode = document.getElementById('rate-avg');
  var errorNode = document.createElement('div');
  errorNode.className = 'alert alert-danger';
  var infoNode = document.createElement('div');
  infoNode.className = 'alert alert-info';
  var updateBuffer = makeDisplayBuffer(10);
  var freq;
    type: 'info',
    message: 'Connecting...'
  socket.on('connect', function() {
      type: 'info',
      message: 'Connected! Listening for events...'
    freq = new Frequency(1000, function (count, average) {
      rateMinNode.textContent = count;
      rateAvgNode.textContent = average;

    // Subscribe to one or more wikis
    // See
    socket.emit('subscribe', '*');

  socket.on('change', function(rc) {
    if (freq) { freq.add(1); }

    // See
    if (rc.type == 'edit') {
        type: 'rc',
        data: rc


  socket.on('error', function(data) {
     type: 'error',
     data: data || /* Hardcoded as of 2017-07-10 */ '[error] Server unavailable'

  function printEvent(event) {
    var node;
    if (event.type === 'rc') {
      var node = document.createTextNode(JSON.stringify( + '\n\n');
    } else if (event.type === 'error') {
      if (!errorNode.parentNode) {
    } else if (event.type === 'info') {
      if (!infoNode.parentNode) {

  function makeDisplayBuffer(size) {
    var buffer = [];
    return function (element) {
      if (buffer.length > size) {
        var popped = buffer.shift();

function Frequency(interval, callback) {
  var freq = this;
  var rAF = window.requestAnimationFrame || setTimeout;

  this.interval = interval;
  this.callback = callback;
  this.count = 0; = 0;
  this.since = this.start =;
  function checker() {
} = ( function () {
  var perf = window.performance;
  return ?
    function () { return; } :
    function () { return +new Date(); };
}() );
Frequency.prototype.add = function (count) {
  this.count += count; += count;
Frequency.prototype.check = function () {
  var count, avg, ellapsedTotal;
  var ellapsed = - this.since;
  if (ellapsed >= this.interval) {
    ellapsedTotal = - this.start;
    count = this.count;
    // One optional digit
    avg = ( / (ellapsedTotal / this.interval)).toFixed(1).replace('.0', '');
    this.since =;
    this.count = 0;
    this.callback(count, avg);