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.


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.


  function remReSize() {
    var deviceWidth = document.documentElement.clientWidth;
    if (deviceWidth > 750) deviceWidth = 750; = deviceWidth / 7.5 + "px";
  window.onload = function() {
    window.onresize = function() {
<div class="main">
  <div class="line-height-center">
    <a href="javascript:;" class="btn">
  <div class="after-center">
    <a href="javascript:;" class="btn">
  <div class="flex-center">
    <a href="javascript:;" class="btn">
  <div class="absolute-center">
    <a href="javascript:;" class="btn">
  <button class="change-btn">切换语言</button>
  <button class="weight-btn">切换加粗</button>


  margin: 0
  padding: 0

html, body
  background-image: linear-gradient(to top, #dfe9f3 0%, white 100%);
  -webkit-tap-highlight-color: transparent

  position: relative
  width: 7.5rem
  min-height: 100vh
  margin: 0 auto
  overflow: hidden
  font-size: 0;
    margin-top: .1rem

$c = #999

  display: inline-block;
  height: .5rem;
  box-sizing: border-box;
  width: 100%;
  padding: 0 .2rem;
  text-decoration: none;
  border-radius: .1rem;
  font-size: .28rem;
  background-image: linear-gradient(to top,$c 23%, #000 24%, #000 26%, $c 27%, $c 48%, #000 49%, #000 51%, $c 52%, $c 73%, #000 74%, #000 76%, $c 77%);
    font-weight 700

.change-btn, .weight-btn
  display: block;
  margin: 0 auto;
  margin-top: .1rem;

.line-height-center .btn
  line-height: .5rem;
  text-align: center;
    text-align: center;
      vertical-align: middle;
      content: '';
      display: inline-block;
      height: 100%;
      vertical-align: middle;

.flex-center .btn
  display: flex;
  align-items: center;
  justify-content: center;

    position: relative;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      white-space: nowrap;


                $('.change-btn').on('click', function() {
  if($('html').attr('lang') == 'en') {
  } else {

var weight = false;
$('.weight-btn').on('click', function() {
  if(weight) {
    weight = false;
  } else {
    weight = true;