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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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>Исправить</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>
      Я сайдбар
    </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