cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="container">
<button>Toggle Fix</button>
  <div class="grid">
    <article class="post">
      <div>
        <pre><code>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Excepturi ex tempora velit repellat vitae! Quidem itaque, error, officiis magni at vel architecto sit blanditiis fugiat dolorem a quia dolorum doloremque.</code></pre>
      </div>
      </article>
    <aside>
      I AM A SIDEBAR
    </aside>
  </div>
</div>
            
          
!
            
              * {
  box-sizing: border-box;
}

img {
  max-width: 100%;
  height: auto;
}

aside {
  background: pink;
  text-align: center;
}

.container {
  padding: 0 2em;
  width: 100%;
  max-width: 1234px;
  margin: 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-gap: 2em;
}

// RUT-ROH
// Let's say inside a Grid we have an overflow-x element, like a standard <pre><code> block...
pre {
  overflow-x: auto;
  background: lightgrey;
  padding: 1em;
  max-width: 100%;
}

// That element will break the grid due to the nature of its inherent `white-space: pre|nowrap`
// Your first instinct is to wrap that element in a `<div>` and overflow hidden it
// (like a responsive table or something)

.post div {
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}
// THESE DO NOTHING. WOMP WOMP.

// To Fix, you have to go all the way up and specify DISABLE the default `min-width: auto` on the Grid Item 

// .grid > * {
//   min-width: 0;
// }
// THIS IS THE FIX

.fix .grid > * {
  min-width: 0;
}

            
          
!
            
              document.querySelector('button').addEventListener('click', function(event) {
  event.preventDefault();
  document.body.classList.toggle('fix');
});
            
          
!
999px
Loading ..................

Console