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.

            
              .container
  .contacts
    .buttons
      button.new-message.fa-envelope-o
      button.search.fa-search
    ul
      - for i in 1..4
        li
  .messages
    ul
      - for i in ['Is this the real life?', 'Is this just fantasy?', 'Caught in a landslide', 'No escape from reality.', 'Open your eyes', 'Look up to the skies and see', 'I\'m just a poor boy, I need no sympathy', 'Because I\'m easy come, easy go', 'Little high, little low', 'Anyway the wind blows doesn\'t really matter to me, to me.', 'Mama, just killed a man', 'Put a gun against his head', 'Pulled my trigger, now he\'s dead.', 'Mama, life had just begun', 'But now I\'ve gone and thrown it all away.', 'Mama, ooh', 'Didn\'t mean to make you cry', 'If I\'m not back again this time tomorrow', 'Carry on, carry on as if nothing really matters.', 'Too late, my time has come', 'Sent shivers down my spine', 'Body\'s aching all the time.', 'Goodbye, everybody, I\'ve got to go', 'Gotta leave you all behind and face the truth.', 'Mama, ooh (anyway the wind blows)', 'I don\'t wanna die', 'I sometimes wish I\'d never been born at all.', 'I see a little silhouetto of a man', 'Scaramouche, Scaramouche, will you do the Fandango?', 'Thunderbolt and lightning', 'Very, very frightening me.', '(Galileo) Galileo.', '(Galileo) Galileo', 'Galileo Figaro', 'Magnifico.', 'I\'m just a poor boy, nobody loves me.', 'He\'s just a poor boy from a poor family', 'Spare him his life from this monstrosity.', 'Easy come, easy go, will you let me go?', 'Bismillah! No, we will not let you go. (Let him go!)', 'Bismillah! We will not let you go. (Let him go!)', 'Bismillah! We will not let you go. (Let me go!)', 'Will not let you go. (Let me go!)', 'Never, never let you go', 'Never let me go, oh.', 'No, no, no, no, no, no, no.', 'Oh, mama mia, mama mia (Mama mia, let me go.)', 'Beelzebub has a devil put aside for me, for me, for me.', 'So you think you can stone me and spit in my eye?', 'So you think you can love me and leave me to die?', 'Oh, baby, can\'t do this to me, baby', 'Just gotta get out, just gotta get right outta here.', '(Oh, yeah, oh yeah)', 'Nothing really matters', 'Anyone can see', 'Nothing really matters', 'Nothing really matters to me.', 'Anyway the wind blows.']
        li #{i}
  .stack-wrap
  .form
    .form-inner
      button ✚
  
            
          
!
            
              =clearfix
  &::after
    content: ' '
    display: block
    clear: both
    height: 0
    visibility: hidden
    font-size: 0

html, body, .container
  height: 100%
  overflow: hidden
  
body
  margin: 0

.container
  width: 100%
  display: flex
  flex-flow: column wrap
    
.contacts
  flex-basis: 100%
  width: 240px
  overflow-y: hidden
  background-color: skyblue
  //background-image: linear-gradient(-45deg, rgba(0, 0, 0, 0) 45%, whitesmoke 49%, whitesmoke 51%, rgba(0, 0, 0, 0) 55%)
  background-size: 6px 6px
  
  .buttons
    margin-right: 6px
    +clearfix
  
  button
    float: right
    height: 30px
    width: 30px
    margin: 8px 6px 12px
    padding: 0
    border: 0
    border-radius: 2px
    font-family: Fontawesome
    color: skyblue
    background: whitesmoke
    cursor: pointer
    
  ul
    width: calc(100% - 12px * 2)
    margin: 0 12px
    padding: 0
    list-style: none
    
  li
    position: relative
    width: 100%
    height: 84px
    margin-bottom: 12px
    border-radius: 2px
    background: whitesmoke
      
    &::before
      content: ''
      position: absolute
      top: 18px
      left: 12px
      height: 48px
      width: 48px
      border-radius: 30px
      background: gainsboro
        
    &::after
      content: '✖'
      position: absolute
      top: -8px
      right: -8px
      overflow: hidden
      height: 0
      line-height: 26px
      width: 0
      margin: 12px
      border-radius: 12px
      text-align: center
      color: whitesmoke
      background: tomato
      cursor: pointer
      transition: height 0.1s, width 0.1s, margin 0.1s
    
    &:hover
      &::after
        height: 24px
        width: 24px
        margin: 0
    
.messages, .form
  width: calc(100% - 240px)
    
.messages
  flex: 1 1px
  background: tomato
  overflow-y: scroll
    
  ul
    list-style: none
    margin: 0
    padding: 36px
    +clearfix
      
  li
    float: left
    clear: both
    line-height: 1.4em
    max-width: 224px
    margin: 12px
    padding: 0.7em 16px
    border-radius: 18px
    font-family: sans-serif
    color: whitesmoke
    background: skyblue
    
    &:nth-child(odd)
      border-bottom-left-radius: 2px

    &:nth-child(even)
      float: right
      border-bottom-right-radius: 2px
 
.form
  background: gainsboro
    
.form-inner
  height: 60px
  width: calc(100% - 12px * 2) // ugh just let me use border-box
  margin: 12px
  border-radius: 2px
  background: whitesmoke
    
  button
    float: right
    height: 100%
    width: 60px
    padding: 1px0 
    border: 0
    border-radius: 0 2px 2px 0
    font: 30px/60px sans-serif
    color: whitesmoke
    background: skyblue
    cursor: pointer

.small-screen
  &.container
    align-content: center
  
  .stack-wrap
    position: relative
    flex: 1 1px
    
    div
      position: absolute
      top: 0
      bottom: 0
    
  .contacts
    left: 0
    width: 66px
    
    .buttons
      display: none //TODO
    
    ul
      width: 100%
      margin: 0
      
    li
      height: 66px
      margin: 0
      background: transparent
      
      &::before
        top: 9px
        left: 9px
        background: whitesmoke
          
      &::after
        top: -2px
        right: 2px
    
  .messages
    left: 66px
    right: 0
    width: auto
    
  .form
    width: 100%

            
          
!
            
              !function () {
  var container = document.querySelector('.container');
  var stackWrap = document.querySelector('.stack-wrap');
  var contacts = document.querySelector('.contacts');
  var messages = document.querySelector('.messages');
  var small, limiter;

  function relayout () {
    var width = window.innerWidth;
    console.log(width, small);
    if (!small && width < 600) {
      small = true;
      container.classList.add('small-screen');
      stackWrap.appendChild(contacts);
      stackWrap.appendChild(messages);
    } else if (small && width >= 600) {
      small = false;
      container.classList.remove('small-screen');
      container.insertBefore(contacts, stackWrap);
      container.insertBefore(messages, stackWrap);
    }
  }

  window.addEventListener('resize', function () {
    clearTimeout(limiter);
    limiter = setTimeout(relayout, 100);
  });

  relayout();
}();

            
          
!
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