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

              
                  <div class="chat-head">
    <a class="person"></a>
     <div class="message">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nisl dolor, lacinia eu eleifend ac, hendrerit vel felis. Donec vel interdum felis</p></div>
 </div>
  <div class="chat-head">
    <a class="person"></a>
     <div class="message">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nisl dolor, lacinia eu eleifend ac, hendrerit vel felis. Donec vel interdum felis. Sed non massa vel mauris consectetur facilisis sed sit amet neque. Praesent interdum venenatis est a tempus. Quisque sit amet congue enim. Maecenas a tortor sit amet orci dignissim viverra sed quis nulla. Maecenas consequat eros at augue vehicula at blandit est dictum. Etiam orci tortor, sollicitudin dignissim molestie vel, elementum vel mi. Aliquam pulvinar imperdiet ultricies.</p></div>
 </div>
 
<div class="intro">
  <h1>CSS Chat Heads</h1>
  <p>Just because I needed a first pen. Drag and click to your heart's consent. Now with jQuery Touch Punch.</p>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Raleway:400,700);

body {
  margin-top: 4px;
  background: white url('http://glamanate.com/wp-content/themes/glamanate/images/groovepaper.png');
  font-family: 'Raleway', serif;
}

.chat-head {
  position: absolute;
  right:5px;
  top:0;
  z-index:9999;
  width: 52px;
  height: 52px;
}
.chat-head .person {
  cursor: pointer;
  display:block;
  width: 100%;
  height: 100%;
  background: url('http://gravatar.com/avatar/6f1c544038110c03167685afa17993eb?s=80') no-repeat center;
  background-size: 105%;
  border-radius: 55px;
  box-shadow: inset 1px 1px 10px rgba(0,0,0,0.7), 0 0 5px rgba(0,0,0,1);
  border: 1px solid rgba(255,255,255,0.3);
}
.chat-head .message {
  float: right;
  display:none;
  position:absolute;
  left:-290px;
  top: 13px;
  background: linear-gradient(to bottom, rgba(222,239,255,1) 0%,rgba(152,190,222,1) 100%);
  padding: 4px 10px;
  min-height: 30px;
  width:250px;
  border-radius: 3px;
  box-shadow:inset 0px 0 3px rgba(255,255,255,0.3), 0 0 1px black;
}
.chat-head .message:after {
  position: absolute;
  top:7px;
  right:-16px;
  display: block;
  content:'';
  border-top: 13px solid transparent;
  border-bottom:13px solid transparent;
  border-left: 15px solid rgb(184, 212, 237);
}
.chat-head p {
  margin:0;
  font-size: 12px;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.1);
}

/** Just to fancy it up **/
.intro {
  width: 80%;
  margin: 10px auto;
}
.intro h1 {
  text-transform: uppercase;
  font-size: 60px;
  font-weight: 700;
  color: #357ab7;
  text-shadow: 1px 1px 1px #2b4c68;
}
.intro p {
  color: #5b6e7f;
}

@media (max-width: 767px) {
  .chat-head {
    width: 46px;
    height: 46px;
  }
  .chat-head .message {
    top: 8px;
  }
}
              
            
!

JS

              
                (function($) {
  /** Uses jQuery Touch Punch hack for mobile support
  ** http://touchpunch.furf.com/
  **/
  
  $('.chat-head').draggable({
    axis: "y",
    opacity: 0.8,
    scroll: false,
    start: function(event, ui) {
      ui.helper.bind("click.prevent",
      function(event) { event.preventDefault(); });
    },
    stop: function(event, ui) {
      setTimeout(function(){
        ui.helper.unbind("click.prevent");}, 300);
        }
   });
  $('.chat-head').click(function (e) {
    var chatMessage = $(this).find('.message');
    //First, hide any open messages that aren't us
    if( !chatMessage.is(':visible') ) {
      $('.message:visible').hide();
    }
    //Toggle child message
    chatMessage.toggle(100);
  }); 
  
  //Make sure our chat heads don't stack
  $(document).ready(function() {
    var chats = $('.chat-head');
    chats.each(function(i) {
      $(chats[i]).css('top', i*60);
    });
  });
})(jQuery);
              
            
!
999px

Console