Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <div class="content">
  <section class="box box-1">
    <h2>1</h2>
    <p>Malaga is the southernmost large city in Europe</p>
  </section>

  <section class="box box-2">
    <h2>2</h2>
    <p>Malaga is one of the world’s oldest cities</p>
  </section>

  <section class="box box-3">
    <h2>3</h2>
    <p>Malaga enjoys an average of 300 days of sunshine</p>
  </section>
</div>
<div class="controls">

  <label for="direction">direction:</label>
  <select id="direction">
    <option value="ltr">ltr</option>
    <option value="rtl">rtl</option>
  </select>

  <label for="writingmode">writing-mode:</label>
  <select id="writingmode">
    <option value="horizontal-tb">horizontal-tb</option>
    <option value="vertical-lr">vertical-lr</option>
    <option value="vertical-rl">vertical-rl</option>
  </select>

</div>
              
            
!

CSS

              
                //For better results, open this using Firefox
$space: 1rem;
$dark: #16215c;
$medium: #f89673;
$light: #addcec;
$txt-color: #1F2329;

body {
  background: $dark;
  color: white;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  justify-content: center;

  //Logical sizing: 
  max-inline-size: 100vw; //max-width
  min-block-size: 100vh; //max-height

  //Logical padding: 
  padding-inline-end: 5vw; //padding-left
  padding-inline-start: 5vw; //padding-right
}

.content {
  display: grid; 
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: minmax(auto, .65fr);
  grid-gap: $space;
  margin: 0 auto;

  max-inline-size: 1024px; //max-width
  

  .box {
    position: relative;
    background: lighten($dark, 8);
    padding: 1em;
    margin: .5em;
    display: flex;
    align-items: center;
    box-shadow: 0 .2em 20px rgba(black, .16);

    border-end-end-radius: 10px; //border-bottom-right-radius
    padding-inline-start: $space*4; //padding-right
    margin-inline-start: $space*2; //margin-right
    
    h2 {
      position: absolute;
      inline-size: $space*4;
      block-size: $space*4;
      border-radius: 50%;
      background: $light;
      color: $dark;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0; //reset
      font-size: 32px;
      font-weight: 800;

      //Please position me -$space away from the start of the block;
      // left: -$space; //wrong
      inset-inline-start: -$space; //right - always on the start of the element

    }

  }

  .box-2 {
    h2 {
      background: $medium;
    }
  }

}

// other styles
.controls {
  position: fixed;
  padding: 1em;
  bottom: 0;
}


body {
  &:after {
    content: "";
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    right: 0;
    background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/338327/malaga-night.jpg);
    background-size: cover;
    opacity: .25;
    z-index: -1;
  }
}
              
            
!

JS

              
                $(document).ready(function() {
  $("#direction").change(function() {
    var direction = $("#direction").val();
    $(".box").css("direction", direction);
  });

  $("#writingmode").change(function() {
    var wmode = $("#writingmode").val();
    $(".box").css("writing-mode", wmode);
  });
});


//Credits for the controls: https://codepen.io/amonus/pen/vPdmQE
              
            
!
999px

Console