Pen Settings

HTML

CSS

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

JavaScript

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

Behavior

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

              
                <aside class="no-aside">
  <a class="toggle">
    <i></i>
  </a>
</aside>
<main>
  <h1> Transitions on grid-template-columns (sort of..)</h1>
  <p>CSS Grid is supposed to have five animatable properties: <code>grid-gap, grid-row-gap, grid-column-gap, grid-template-columns and grid-template-rows</code></p>
  <p>But browsers have not implemented it  so far.</p>
  <p>Here's a typical example where we would like to animate the <code>grid-template-columns</code>: adjusting the column track width for the aside menu. Unfortunatelly, that's not possible at the moment.</p>
 <p> But we can use this hack, which consist on animating the width of the aside instead, while setting the <code>grid-template-columns</code> as  <code>min-content 1fr</code> </p>
  <p><strong>Toggle the menu</strong> to check it </p>
</main>
              
            
!

CSS

              
                body {
  font-family:sans-serif;
  display: grid;
  grid-template-columns: min-content 1fr;
  margin: 0;
  width: 100vw;
  height: 100vh;
}

aside {
  width:200px;
  background: #111;
  color: #fff;
  transition: width 1s;
}

.no-aside{
  width:60px;
}

main {
  background: #EEE;
}

h1, p{
  margin:1rem;
}

p{
  font-size:1.2rem;
  color:#333;
}

.toggle {
  width: 40px;
  height: 40px;
  display: block;
  position: relative;
  margin-top:1rem;
}

.toggle i,
.toggle i::after,
.toggle i::before {
  position: absolute;
  width: 40px;
  height: 4px;
  border-radius: 4px;
  transition: transform .15s;
  background-color: #fff;
}

.toggle i {
  top: 46%;
  left: 18%;
  display: block;
  background:#EEE;
}

.toggle i::before {
  top: -10px;
}

.toggle i::after {
  bottom: -10px;
}

.toggle i::after,
.toggle i::before {
  content: '';
  display: block;
}

.toggle i::before {
  transform: translate3d(-8px, 0, 0) rotate(-45deg) scale(0.7, 1);
}

.toggle i::after {
  transform: translate3d(-8px, 0, 0) rotate(45deg) scale(0.7, 1);
}

.no-aside .toggle i::before,
.no-aside .toggle i::after {
  transform: none;
}
              
            
!

JS

              
                document.querySelector('.toggle').addEventListener('click', e =>
  document.querySelector('aside').classList.toggle('no-aside')
)
              
            
!
999px

Console