css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
               <main>
    <div>
      <section class="element01">
        <h2>Tiles Flexbox Layout</h2>
        <p>
          Grid, however great, still is not supported by over 10% of browser. So, lets try functional, tiles
          layout builded only on Flexbox. This is demonstration of basic possibilities.
        </p>
      </section>
      <section class="element02">
        <h2>Rules</h2>
        <ul>
          <li>Tile Layout buided only on Flexbox - no Grid, Float, etc</li>
          <li>Standard compliant</li>
          <li>Minimal number of elements - only two containers here</li>
          <li>RWD - four layouts for different resolutions</li>
          <li>Mobile First - Builded from bottom to the top</li>
          <li>Tested on Chromium, Vivaldi (Blink), and Mozilla Firefox (Gecko)</li>
          <li>Firefox failed, for a reason I'm looking for.</li>
        </ul>

      </section>
      <section class="element03">
        <h2>Full RWD</h2>
        <p>
          CSS is created from the lowest resolution, and at the beginning this is only one column of identical elements.</p>
        <p>First breakpoint is at 768px, and it's sets some of tiles two in a row, some still only one.
        </p>
        <p>Second breakpoint is at 1024, and it's changing top of a layout. Two columns at the top: left has three elements, right only one - for main, important content (like oe News). This top can be easily highlighted, because all four first elements are included in one container.</p>
        <p>Third breakpoint adds a margin between tiles and transparent background making main element invisible.</p>
      </section>
      <section class="element04">
        <h2>Order of  Elements</h2>
        <p>
          Not only layout is changing. With the second breakpoint the second element is move to the end of container.
        </p>
      </section>
    </div>
    <section class="element05">
      <h2>Title of Element</h2>
      <p>
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Natus,
        veniam reiciendis, minus reprehenderit praesentium ullam voluptas
        vitae porro aliquam, asperiores laborum neque ipsum iusto cumque!
        Magni fugit corrupti nostrum illum!
      </p>
    </section>
    <section class="element06">
      <h2>Title of Element</h2>
      <p>
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Natus,
        veniam reiciendis, minus reprehenderit praesentium ullam voluptas
        vitae porro aliquam, asperiores laborum neque ipsum iusto cumque!
        Magni fugit corrupti nostrum illum!
      </p>
    </section>
    <section class="element07">
      <h2>Title of Element</h2>
      <p>
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Natus,
        veniam reiciendis, minus reprehenderit praesentium ullam voluptas
        vitae porro aliquam, asperiores laborum neque ipsum iusto cumque!
        Magni fugit corrupti nostrum illum!
      </p>
    </section>
    <section class="element08">
      <h2>Title of Element</h2>
      <p>
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Natus,
        veniam reiciendis, minus reprehenderit praesentium ullam voluptas
        vitae porro aliquam, asperiores laborum neque ipsum iusto cumque!
        Magni fugit corrupti nostrum illum!
      </p>
    </section>
    <section class="element09">
      <h2>Title of Element</h2>
      <p>
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Natus,
        veniam reiciendis, minus reprehenderit praesentium ullam voluptas
        vitae porro aliquam, asperiores laborum neque ipsum iusto cumque!
        Magni fugit corrupti nostrum illum!
      </p>
    </section>
    <section class="element10">
      <h2>Title of Element</h2>
      <p>
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Natus,
        veniam reiciendis, minus reprehenderit praesentium ullam voluptas
        vitae porro aliquam, asperiores laborum neque ipsum iusto cumque!
        Magni fugit corrupti nostrum illum!
      </p>
    </section>
    <section class="element11">
      <h2>Footer</h2>
      <p>
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Natus,
        veniam reiciendis, minus reprehenderit praesentium ullam voluptas
        vitae porro aliquam, asperiores laborum neque ipsum iusto cumque!
        Magni fugit corrupti nostrum illum!
      </p>
    </section>
  </main>
            
          
!
            
               main {
    background-color: #ffa;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
  }

  main section {
    flex: 1;
    margin: 5px 10px;
    border: 1px solid #aaa;
    box-sizing: border-box;
  }

  section>h2 {
    background-color: #000;
    color: #ddd;
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    padding-left: 2rem;
  }

  p {
    padding: 0.4rem;
  }

  @media (min-width: 768px) {
    main {
      margin: 0 auto;
      flex-direction: row;
      flex-wrap: wrap;
    }

    main section {
      border: none;
      background-color: #dd6;
      flex: 1;
      width: 50%;
      border: none;
    }

    main>div {
      display: flex;
      flex-wrap: wrap;      
    }

    main>div>section {
      flex: 1;
      flex-basis: calc(50% - 20px);
    }

    .element07,
    .element10,
    .element11 {
      flex-basis: 100%;
    }
  }

  @media (min-width: 1024px) {
    main {
max-width: 1024px; /* firefox needs that */
    }

    main>div {
      flex-direction: column;      
    }

    .element02 {
      order: 4;
      flex: 3 0 100%;      
          }

    .element01,
    .element03,
    .element04 {
      flex: 1;      
    }

    .element01 {
      order: 1;
    }

    .element03 {
      order: 2;
    }

    .element04 {
      order: 3;
    }

    main section {
      margin: 0;
    }

    section>h2 {
      background-color: rgba(50, 50, 50, 0.5);
      color: #ffe;
      padding: 5px 0 5px 3rem;
    }
  }

  @media (min-width: 1400px) {
    main {
         max-width: 1400px; /* firefox needs that */       background-color: transparent;
    }
 
    main section {
      margin: 5px;
    }

    main section:hover {
      box-shadow: 2px 2px 3px rgba(120, 120, 120, 0.3);
    }

    .element01,
    .element03,
    .element04 {
      width: calc(50% - 10px);
    }

    .element02 {
      flex: 3 0 calc(100% - 10px);
      width: calc(50% - 10px);
    }

    section>h2 {
      background-color: rgba(80, 80, 80, 0.3);
      color: #ff9;
      padding: 8px 0 8px 3rem;
    }
  }

  /* SECTIONS COLORS */
  .element01 {
    background-color: #dd6;
  }

  .element02 {
    background-color: #dd9;
  }

  .element03 {
    background-color: #ddc;
  }

  .element04 {
    background-color: #ddf;
  }

  .element05 {
    background-color: #de0;
  }

  .element06 {
    background-color: #de6;
  }

  .element07 {
    background-color: #de9;
  }

  .element08 {
    background-color: #dec;
  }

  .element09 {
    background-color: #def;
  }

  .element10 {
    background-color: #df0;
  }

  .element11 {
    background-color: #dfc;
  }
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console