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.




              html, body {
  height: 100%;
  margin: 0;
  padding: 0;

.CodeMirror {
  background: #ccc;

.CodeMirror-lines {
  padding-bottom: 50%;


              CodeMirror.commands.wpScrollSelectionToCenter = function(cm) {
  if (cm.getOption("disableInput")) {
    return CodeMirror.Pass;

  // 获取当前光标所在位置
  let top = cm.cursorCoords(true, "local").top;
  // 获取当前编辑器高度
  let editor_height = cm.getWrapperElement().offsetHeight;
  // 获取当前行高
  let lh = cm.defaultTextHeight();
  let scroll_y = Math.round(top - editor_height / 2 + lh / 2);
  cm.scrollTo(null, scroll_y);

function updateByTypewriterMode(cm, changes) {
  if (cm.getSelection().length !== 0) {

  const scroll_origins = ["+input", "+delete", "*compose", "paste"];

  for (let i = 0, len = changes.length; i < len; i++) {
    let each = changes[i];
    let origin = each.origin;
    if (scroll_origins.includes(origin)) {

const cm = CodeMirror(document.body, {
  lineNumbers: true

cm.setSize("100%", "100%");
cm.on("changes", (cm, changes) => updateByTypewriterMode(cm, changes));