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.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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.

            
              <div class="flex-container" data-tooltip="Click the background to change the layout in use.">
  <h3 class="flex-title">Float</h3>
  <div class="flex-child">
    <h2 class="title">Title</h2>
    <div class="content">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer hendrerit ligula sed sapien molestie, a luctus purus dignissim. Maecenas consectetur bibendum orci volutpat varius. Quisque urna orci, tincidunt sed nisl rutrum, molestie euismod velit. Sed ac metus at sem suscipit scelerisque non eu ligula. Praesent lobortis suscipit consectetur. Aliquam id venenatis justo.s</p>
    </div>
  </div>
  <div class="flex-child">
    <h2 class="title">Title</h2>
    <div class="content">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer hendrerit ligula sed sapien molestie, a luctus purus dignissim. Maecenas consectetur bibendum orci volutpat varius. Quisque urna orci, tincidunt sed nisl rutrum, molestie euismod velit. Sed ac metus at sem suscipit scelerisque non eu ligula. Praesent lobortis suscipit consectetur. Aliquam id venenatis justo. Nulla dui quam, iaculis a sodales id, elementum quis purus.</p>
    </div>
  </div>
  <div class="flex-child">
    <h2 class="title">Title</h2>
    <div class="content">
      <p>Sed consectetur leo in congue pretium. Maecenas pretium ligula a pellentesque luctus. Curabitur in nunc quis magna dignissim dignissim. Aliquam interdum neque ornare aliquet eleifend. Mauris libero tellus, mattis quis mattis in, fringilla id quam.</p>
    </div>
  </div>
</div>
            
          
!
            
              body {
  margin: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto', sans-serif;
}

.flex-container {
  width: 80vw;
  background-color: #8ae8d7;
  height: auto;
  padding: 1em;
  user-select: none;
  
  &[data-tooltip]:not(.notooltip) {
    position: relative;
    
    &:before {
      content: attr(data-tooltip);
      display: block;
      position: absolute;
      left: 0;
      top: -50px;
      padding: 1em;
      background-color: #222;
      color: #fff;
      opacity: 0;
      transition: opacity .5s;
    }
    
    &:hover {
      &:before {
        opacity: 1;
      }
    }
  }
  
  &.flexit {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: stretch;
    
    .flex-child {
      float: none;
      clear: none;
      margin-left: 0;
      flex-basis: 30%;
      width: 100%;
      min-width: 200px;
    }
  }
  
  .flex-title {
    width: 100%;
    float: left;
    clear: both;
    text-align: center;
    margin: 0;
    padding: 1em 0;
    align-self: flex-start;
  }
}

.flex-child {
  width: 30%;
  background-color: #bcfcff;
  float: left;
  margin-left: 5%;
  margin-bottom: 10px;
  
  &:first-of-type {
    margin-left: 0;
  }
  
  .title {
    text-align: center;
  }
  
  .content {
    padding: 0 10px;
  }
}

            
          
!
            
              var toggle = true;
var count = 0;
$('.flex-container').click(function() {
  if (toggle) {
    $(this).removeClass('flexit');
    $('.flex-title').text('Float');
    toggle = false;
  }
  else {
    $(this).addClass('flexit');
    $('.flex-title').text('Flex');
    toggle = true;
  }
  if (count === 1) {
    $(this).addClass('notooltip');
  }
  count++;
});
            
          
!
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