Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                .at-header
  .at-header__content
    .at-header__title Generator
    .at-nav
      ul.at-nav__menu
        li.at-nav__item: a(href="https://codepen.io/andytran/pen/BKOOQy") Demo
        li.at-nav__item: a(href="https://www.elegantthemes.com/blog/community/free-divi-code-snippets-and-a-growing-github-resource-repo-by-andy-tran-the-divi-nation-podcast-episode-21") Article
  .at-btn-group
    //- button.at-btn.at-btn--inverse#copy(data-clipboard-target="#code") Code
    button.at-btn#show-code(data-clipboard-target="#code") Copy to Cipboard

.at-content
  .at-container
    .at-card
      .at-card__header
        .at-card__title Global
      .at-form#form-0
        .at-form__group
          label.at-label Title
          input.at-input.at-input--block(type="text" name="section-title" value="The Team" placeholder="Title")
        .at-form__group
          label.at-label Column
          input.at-input.at-input--block(type="text" name="column" value="3" placeholder="Column")
          
    .at-card.user-input
      .at-card__header
        .at-card__title User #1
        .at-card__close.remove-person
      .at-form#form-1
        .at-form__group
          input.at-input.at-input--block(type="text" name="name" placeholder="Name")
        .at-form__group
          input.at-input.at-input--block(type="text" name="title" placeholder="Title")
        .at-form__group
          input.at-input.at-input--block(type="text" name="avatar" placeholder="Image URL")
        .at-form__group
          input.at-input.at-input--block(type="text" name="facebook" placeholder="Facebook URL")
          input.at-input.at-input--block(type="text" name="twitter" placeholder="Twitter URL")
          input.at-input.at-input--block(type="text" name="linkedin" placeholder="LinkedIn URL")
    button.at-btn.at-btn--block#add-person Add Another Person

textarea#code
              
            
!

CSS

              
                $prefix: at;
$accent: #2EB7FC;
$max-width: 800px;

body {
  background: #F4F8F9;
  font-family: 'Raleway', sans-serif;
  font-weight: 400;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.#{$prefix}-container {
  max-width: $max-width;
  width: 100%;
  margin: 0 auto;
  padding: 0 90px;
  box-sizing: border-box;
}

.#{$prefix}-btn {
  display: inline-block;
  background: $accent;
  border: 0;
  border-radius: 2px;
  padding: 12px 20px;
  box-sizing: border-box;
  color: #FFF;
  font-family: 'Raleway', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: normal;
  text-decoration: none;
  cursor: pointer;
  
  &--inverse {
    background: #262B2E;
  }
  &--block {
    display: block;
    width: 100%;
  }
}

.#{$prefix}-form {
  
  &__group {
    display: flex;
    align-items: center;
    margin: 0 0 20px;
    
    .#{$prefix}-btn,
    .#{$prefix}-input {
      margin: 0 20px;
      
      &:first-child,
      &:last-child {
        margin: 0;
      }
    }
    
    &:last-child,
    &:only-child {
      margin: 0;
    }
  }
}

.#{$prefix}-input {
  display: inline-block;
  background: rgba(#000, 0.05);
  border: 0;
  border-radius: 2px;
  margin: 0 0 20px;
  padding: 12px 20px;
  box-sizing: border-box;
  color: #FFF;
  font-family: 'Raleway', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: normal;
  text-decoration: none;
  
  &--block {
    display: block;
    width: 100%;
    color: #64686B;
  }
}

.#{$prefix}-label {
  width: 20%;
  margin: 0 10px 0 0;
  color: #64686B;
  font-size: 0.75rem;
  font-weight: 600;
}

.#{$prefix}-header {
  display: flex;
  align-items: center;
  flex-direction: row;
  justify-content: space-between;
  background: #FFF;
  height: 90px;
  padding: 0 90px;
  margin: 0 0 40px;
  font-family: 'Raleway', sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
  
  &__content {
    display: flex;
    align-items: center;
    flex-direction: row;
  }
  
  &__title {
    z-index: 1;
    position: relative;
    background: $accent;
    margin: 0 40px 0 0;
    padding: 8px 16px;
    color: #FFF;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    
    // &:after {
    //   content: '';
    //   position: absolute;
    //   z-index: -1;
    //   top: 20px;
    //   left: 0;
    //   display: block;
    //   background: rgba($accent, 0.4);
    //   width: 30px;
    //   height: 30px;
    //   transform-origin: left top;
    //   transform: skew(45deg) rotate(-45deg);
    // }
  }
}

.#{$prefix}-nav {
  &__menu {
    display: flex;
    flex-direction: row;
  }
    
  &__item {
    margin: 0 20px 0 0;
    color: #64686B;
    font-size: 0.75rem;
    font-weight: 600;
    
    a {
      color: inherit;
      text-decoration: none;
    }
  }
}

.#{$prefix}-card {
  background: #FFF;
  border-radius: 2px;
  margin: 0 0 30px;
  padding: 30px;
  
  &__header {
    display: flex;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    margin: 0 0 20px;
  }
  
  &__title {
    color: #262B2E;
    font-size: 1.125rem;
    font-weight: 600;
  }
  
  &__close {
    position: relative;
    width: 14px;
    height: 14px;
    
    &:before,
    &:after {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      display: block;
      background: #262B2E;
      width: 100%;
      height: 2px;
      border-radius: 10px;
    }
    
    &:before {
      transform: translateY(-50%) rotate(45deg);
    }
    
    &:after {
      transform: translateY(-50%) rotate(-45deg);
    }
  }
}

#code {
  position: fixed;
  top: 0;
  left: 0;
  display: block;
  width: 0;
  height: 0;
  opacity: 0;
}
              
            
!

JS

              
                /* Ignore the mess */

let formCount = 1;

let addPerson = () => {
  $(document).on('click', '#add-person', function(e) {
    e.preventDefault();
    formCount++;

    let formCode = '<div class="at-card user-input"> <div class="at-card__header"> <div class="at-card__title">User #' + formCount + '</div> <div class="at-card__close remove-person"></div> </div> <div id="form-' + formCount +'" class="at-form"> <div class="at-form__group"> <input type="text" name="name" placeholder="Name" class="at-input at-input--block"/> </div> <div class="at-form__group"> <input type="text" name="title" placeholder="Title" class="at-input at-input--block"/> </div> <div class="at-form__group"> <input type="text" name="avatar" placeholder="Image URL" class="at-input at-input--block"/> </div> <div class="at-form__group"> <input type="text" name="facebook" placeholder="Facebook URL" class="at-input at-input--block"/> <input type="text" name="twitter" placeholder="Twitter URL" class="at-input at-input--block"/> <input type="text" name="linkedin" placeholder="LinkedIn URL" class="at-input at-input--block"/> </div> </div> </div>';
    
    $(formCode).insertBefore(this);
  });
};

addPerson();

let removePerson = () => {
  $(document).on('click', '.remove-person', function(e) {
    $(this).parent().parent().remove();
    
    formCount--;
    
    $('.user-input').each(function(i) {
      $(this).children('.at-card__header').children('.at-card__title').text('User #' + (i + 1));
    });
  });
};

removePerson();

$(document).on('change click hover mouseover', '.at-input, body', function() {
    let sectionTitle = $('.at-input[name="section-title"]').val();
    let totalColumn = $('.at-input[name="column"]').val();
  
    let codeInput = '';
  
  $('.user-input').each(function(i) {
    let userName = $(this).find('.at-input[name="name"]').val();
    let userTitle = $(this).find('.at-input[name="title"]').val();
    let userImage = $(this).find('.at-input[name="avatar"]').val();
    let userFacebook = $(this).find('.at-input[name="facebook"]').val();
    let userTwitter = $(this).find('.at-input[name="twitter"]').val();
    let userLinkedIn = $(this).find('.at-input[name="linkedin"]').val();
    
    codeInput += '<div class="at-column"><div class="at-user"> <div class="at-user__avatar"><img src="' + userImage + '"/></div> <div class="at-user__name">' + userName + '</div> <div class="at-user__title">' + userTitle + '</div> <ul class="at-social"> <li class="at-social__item"><a href="' + userFacebook + '"> <svg viewBox="0 0 24 24" width="18" height="18" xmlns="http://www.w3.org/2000/svg"> <path d="M14 9h3l-.375 3H14v9h-3.89v-9H8V9h2.11V6.984c0-1.312.327-2.304.984-2.976C11.75 3.336 12.844 3 14.375 3H17v3h-1.594c-.594 0-.976.094-1.148.281-.172.188-.258.5-.258.938V9z" fill-rule="evenodd"></path> </svg></a></li> <li class="at-social__item"><a href="' + userTwitter + '"> <svg viewBox="0 0 24 24" width="18" height="18" xmlns="http://www.w3.org/2000/svg"> <path d="M20.875 7.5v.563c0 3.28-1.18 6.257-3.54 8.93C14.978 19.663 11.845 21 7.938 21c-2.5 0-4.812-.687-6.937-2.063.5.063.86.094 1.078.094 2.094 0 3.969-.656 5.625-1.968a4.563 4.563 0 0 1-2.625-.915 4.294 4.294 0 0 1-1.594-2.226c.375.062.657.094.844.094.313 0 .719-.063 1.219-.188-1.031-.219-1.899-.742-2.602-1.57a4.32 4.32 0 0 1-1.054-2.883c.687.328 1.375.516 2.062.516C2.61 9.016 1.938 7.75 1.938 6.094c0-.782.203-1.531.609-2.25 2.406 2.969 5.515 4.547 9.328 4.734-.063-.219-.094-.562-.094-1.031 0-1.281.438-2.36 1.313-3.234C13.969 3.437 15.047 3 16.328 3s2.375.484 3.281 1.453c.938-.156 1.907-.531 2.907-1.125-.313 1.094-.985 1.938-2.016 2.531.969-.093 1.844-.328 2.625-.703-.563.875-1.312 1.656-2.25 2.344z" fill-rule="evenodd"></path> </svg></a></li> <li class="at-social__item"><a href="' + userLinkedIn + '"> <svg viewBox="0 0 24 24" width="18" height="18" xmlns="http://www.w3.org/2000/svg"> <path d="M19.547 3c.406 0 .75.133 1.031.398.281.266.422.602.422 1.008v15.047c0 .406-.14.766-.422 1.078a1.335 1.335 0 0 1-1.031.469h-15c-.406 0-.766-.156-1.078-.469C3.156 20.22 3 19.86 3 19.453V4.406c0-.406.148-.742.445-1.008C3.742 3.133 4.11 3 4.547 3h15zM8.578 18V9.984H6V18h2.578zM7.36 8.766c.407 0 .743-.133 1.008-.399a1.31 1.31 0 0 0 .399-.96c0-.407-.125-.743-.375-1.009C8.14 6.133 7.813 6 7.406 6c-.406 0-.742.133-1.008.398C6.133 6.664 6 7 6 7.406c0 .375.125.696.375.961.25.266.578.399.984.399zM18 18v-4.688c0-1.156-.273-2.03-.82-2.624-.547-.594-1.258-.891-2.133-.891-.938 0-1.719.437-2.344 1.312V9.984h-2.578V18h2.578v-4.547c0-.312.031-.531.094-.656.25-.625.687-.938 1.312-.938.875 0 1.313.578 1.313 1.735V18H18z" fill-rule="evenodd"></path> </svg></a></li> </ul> </div></div>';
  });
  
  let codeStyles = '<style>.at-section__title {margin: 0 0 70px; color: #000; font-family: "Roboto", sans-serif; font-size: 3.5rem; font-weight: 300; line-height: 2.625rem; text-align: center; } .at-grid {display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -webkit-flex-direction: row; -ms-flex-direction: row; flex-direction: row; -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap; background: #FFF; border: 1px solid #E2E9ED; } .at-grid[data-column="1"] .at-column {width: 100%; max-width: 100%; min-width: 100%; -webkit-flex-basis: 100%; -ms-flex-preferred-size: 100%; flex-basis: 100%; } .at-grid[data-column="2"] .at-column {width: 50%; max-width: 50%; min-width: 50%; -webkit-flex-basis: 50%; -ms-flex-preferred-size: 50%; flex-basis: 50%; } .at-grid[data-column="3"] .at-column {width: 33.33333%; max-width: 33.33333%; min-width: 33.33333%; -webkit-flex-basis: 33.33333%; -ms-flex-preferred-size: 33.33333%; flex-basis: 33.33333%; } .at-grid[data-column="4"] .at-column {width: 25%; max-width: 25%; min-width: 25%; -webkit-flex-basis: 25%; -ms-flex-preferred-size: 25%; flex-basis: 25%; } .at-grid[data-column="5"] .at-column {width: 20%; max-width: 20%; min-width: 20%; -webkit-flex-basis: 20%; -ms-flex-preferred-size: 20%; flex-basis: 20%; } .at-grid[data-column="6"] .at-column {width: 16.66667%; max-width: 16.66667%; min-width: 16.66667%; -webkit-flex-basis: 16.66667%; -ms-flex-preferred-size: 16.66667%; flex-basis: 16.66667%; } .at-grid[data-column="7"] .at-column {width: 14.28571%; max-width: 14.28571%; min-width: 14.28571%; -webkit-flex-basis: 14.28571%; -ms-flex-preferred-size: 14.28571%; flex-basis: 14.28571%; } .at-grid[data-column="8"] .at-column {width: 12.5%; max-width: 12.5%; min-width: 12.5%; -webkit-flex-basis: 12.5%; -ms-flex-preferred-size: 12.5%; flex-basis: 12.5%; } .at-grid[data-column="9"] .at-column {width: 11.11111%; max-width: 11.11111%; min-width: 11.11111%; -webkit-flex-basis: 11.11111%; -ms-flex-preferred-size: 11.11111%; flex-basis: 11.11111%; } .at-column {position: relative; background: #FFF; box-shadow: 0 0 0 1px #E2E9ED; padding: 10px; box-sizing: border-box; -webkit-transition: box-shadow 0.2s ease, -webkit-transform 0.2s ease; transition: box-shadow 0.2s ease, -webkit-transform 0.2s ease; transition: box-shadow 0.2s ease, transform 0.2s ease; transition: box-shadow 0.2s ease, transform 0.2s ease, -webkit-transform 0.2s ease; } .at-column:before {content: ""; display: block; padding-top: 100%; } .at-column:hover {z-index: 1; box-shadow: 0 8px 50px rgba(0, 0, 0, 0.2); -webkit-transform: scale(1.05); transform: scale(1.05); } .at-column:hover .at-social {margin: 16px 0 0; opacity: 1; } @media (max-width: 800px) {.at-column {width: 50% !important; max-width: 50% !important; min-width: 50% !important; -webkit-flex-basis: 50% !important; -ms-flex-preferred-size: 50% !important; flex-basis: 50% !important; } } @media (max-width: 600px) {.at-column {width: 100% !important; max-width: 100% !important; min-width: 100% !important; -webkit-flex-basis: 100% !important; -ms-flex-preferred-size: 100% !important; flex-basis: 100% !important; } } .at-user {position: absolute; top: 50%; left: 0; width: 100%; -webkit-transform: translate(0, -50%); transform: translate(0, -50%); text-align: center; } .at-user__avatar {width: 98px; height: 98px; border-radius: 100%; margin: 0 auto 20px; overflow: hidden; } .at-user__avatar img {display: block; width: 100%; max-width: 100%; } .at-user__name {color: #313435; font-family: "Roboto", sans-serif; font-size: 1.5rem; font-weight: 500; line-height: 2.625rem; } .at-user__title {color: #6F808A; font-family: "Roboto", sans-serif; font-size: 0.875rem; line-height: 2.375rem; } .at-social {margin: 0 0 -18px; opacity: 0; -webkit-transition: margin 0.2s ease, opacity 0.2s ease; transition: margin 0.2s ease, opacity 0.2s ease; } .at-social__item {display: inline-block; margin: 0 10px; } .at-social__item a {display: block; } .at-social__item svg {fill: #515F65; display: block; height: 18px; -webkit-transition: fill 0.2s ease; transition: fill 0.2s ease; } .at-social__item svg:hover {fill: #788D96; }</style>';
  
  let codeWrapper = codeStyles + '<div class="at-section"><div class="at-section__title">' + sectionTitle + '</div> </div> <div data-column="3" class="at-grid">' + codeInput + '</div>';
  
  $('#code').text(codeWrapper);

});

new Clipboard('.at-btn');
              
            
!
999px

Console