Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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

              
                <!--
Follow me on
------------
Codepen: https://codepen.io/mycnlz/
Dribbble: https://dribbble.com/mycnlz
Pinterest: https://pinterest.com/mycnlz/

-->

<div class='ui'>
  <div class='widget'>
    <div class='widget-header'>App Support</div>
    <div class='widget-conversation'>
      <ul id='conversation'>
        
        <li class='message-left'>
          <div class='message-avatar'>
            <div class='avatar ion-ios-person'></div>
            <div class='name'>Steve</div>
          </div>
          <div class='message-text'>Hello, I'm Steve.</br>How can I help you today?</div>
          <div class='message-hour'>08:55 <span class='ion-android-done-all'></span></div>
        </li>
    
        <li class='message-right'>
          <div class='message-avatar'>
            <div class='avatar ion-ios-person'></div>
            <div class='name'>You</div>
          </div>
          <div class='message-text'>Hi, Steve. I need more information about Developer Plan.</div>
          <div class='message-hour'>08:56 <span class='ion-android-done-all'></span></div>
        </li>
    
        <li class='message-left'>
          <div class='message-avatar'>
            <div class='avatar ion-ios-person'></div>
            <div class='name'>Steve</div>
          </div>
          <div class='message-text'>Ok. Our Developer Plan has 5GB space and you can manage up to 5 projects!</div>
          <div class='message-hour'>08:57 <span class='ion-android-done-all'></span></div>
        </li>
    
        <li class='message-right'>
          <div class='message-avatar'>
            <div class='avatar ion-ios-person'></div>
            <div class='name'>You</div>
          </div>
          <div class='message-text'>Cool. That's all.</div>
          <div class='message-hour'>08:59 <span class='ion-android-done-all'></span></div>
        </li>
    
        <li class='message-left'>
          <div class='message-avatar'>
            <div class='avatar ion-ios-person'></div>
            <div class='name'>Steve</div>
          </div>
          <div class='message-text'>Perfect. If you need any help please contact us.</div>
          <div class='message-hour'>07:00 <span class='ion-android-done-all'></span></div>
        </li>
      </ul>
    </div>

    <div class='widget-form'>
      <textarea id='message'></textarea>
      <button>Send</button>
    </div>

  </div>
  <a href='#' class='btn-support ion-ios-chatboxes'></a>
</div>
              
            
!

CSS

              
                /*--------------------
General Style
---------------------*/
*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
html {
  height: 100%;
  font-family: 'Lato', sans-serif;
  font-weight: 400;
  background: #6d819c;
}

a {
  text-decoration: none;
  cursor: pointer;
}

.left-side {
  float: left;
}

.right-side {
  float: right;
}

/*--------------------
Background Elements
---------------------*/

.ui {
  width: 80%;
  height: 96%;
  position: relative;
  background-color: #e4e7ec;
  border-bottom-right-radius: 6px;
  box-shadow: 0 30px 48px rgba(50,54,70,0.24);
}

a.btn-support {
  width: 50px;
  height: 50px;
  position: absolute;
  right: 8%;
  bottom: 6%;
  color: #c9d6de;
  font-size: 2em;
  text-align:center;
  line-height: 50px;
  background-color: #263959;
  border-radius: 25px;
}

/*--------------------
Message Widget
---------------------*/

.widget {
  width: calc(52% - 100px);
  min-width: 400px;
  height: calc(32% - 60px);
  min-height: 400px;
  position: absolute;
  right: 6%;
  bottom: calc(6% + 70px);
  border-radius: 6px;
  background-color: #fff;
  box-shadow: 0 30px 48px rgba(50,54,70,0.24);
}

.widget:before {
	content: ' ';
	position: absolute;
	width: 0;
	height: 0;
	right: 7%;
  bottom: -30px;
	border: 15px solid;
	border-color: #fff transparent transparent transparent;
}

.widget-header {
  width: 100%;
  height: 30px;
  background-color: #fff;
  font-size: 0.8em;
  line-height: 34px;
  text-align: center;
  text-transform: uppercase;
  color: #7f9eb2;
  box-shadow: 0 1px 0 rgba(50,54,70,0.08);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.widget-conversation {
  height: calc(100% - 100px);
  padding: 12px 24px 12px 20px;
  overflow-y: scroll;
  position: relative;
  background-color: #f4f5f9;
}

ul {
  list-style: none;
}

li.message-left,
li.message-right {
  position: relative;
  margin-left: -40px;
}

.message-avatar {
  width: 40px;
}

li.message-left > .message-avatar {
  float: left;
}

li.message-right > .message-avatar {
  float: right;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  font-size: 3.1em;
  line-height: 40px;
  text-align: center;
  overflow: hidden;
}

li.message-left .avatar {
  float: left;
  color: #9bc6b6;
  background-color: #55967e;
}

li.message-right .avatar {
  float: right;
  color: #b3becc;
  background-color: #6d819c;
}

.name {
  font-size: 0.6em;
  color: #6d819c;
  text-align: center;
}

.message-text {
  max-width: calc(100% - 60px);
  padding: 12px;
  border-radius: 4px;
  background-color: #e7e9f2;
  line-height: 1.1;
  color: #263959;
}

li.message-left > .message-text {
  text-align: left;
  left: 16px;
  margin-left: 60px;
}

li.message-right > .message-text {
  text-align: right;
  right: 16px;
}

.message-text:before {
  content: ' ';
	position: absolute;
	width: 0;
	height: 0;
  top: 10px;
	border: 8px solid;
}

li.message-left > .message-text:before {
  left: 44px;
  border-color: transparent #e7e9f2 transparent transparent;
}

li.message-right > .message-text:before {
  right: 45px;
  border-color: transparent transparent transparent #e7e9f2;
}

.message-hour {
  max-width: calc(100% - 60px);
  padding: 2px;
  color: #a8b0cf;
  font-size: 0.625em;
  margin-bottom: 12px;
}

.message-hour > span {
  color: #8CD790;
}

li.message-left > .message-hour {
  text-align: left;
  margin-left: 60px;
}

li.message-right > .message-hour {
  text-align: right;
}

.widget-form {
  height: 60px;
  padding: 12px 20px;
  position: relative;
  background-color: #fff;
  border-top: 1px solid rgba(50,54,70,0.08);
}

textarea {
  width: calc(100% - 60px);
  padding: 3px;
  background-color: #f4f5f9;
  border: 1px solid #f4f5f9;
  border-radius: 6px;
  outline: none;
}

button {
  color: #8CD790;
  background-color: transparent;
  border: 1px solid #8CD790;
  border-radius: 6px;
  width: 50px;
  float: right;
  margin-top: 8px;
  outline: none;
}

button:hover {
  color: #fff;
  background-color: #8CD790;
  border: 1px solid #8CD790;
}

.message-avatar, .message-text,
.message-hour, button {
  -webkit-transition: all 0.6s ease;
     -moz-transition: all 0.6s ease;
      -ms-transition: all 0.6s ease;
       -o-transition: all 0.6s ease;
          transition: all 0.6s ease;
}
              
            
!

JS

              
                $(document).ready( function(){
  
  $('button').on('click', function () { 
    var text = $('#message').val();
    var hnow = new Date().getHours();
    var mnow = new Date().getMinutes();
    mnow = (mnow < 10) ? ('0' + mnow) : mnow;
    var d = hnow + ":" + mnow;
    
    if(text.length >0){
      $('#message').css("border", "1px solid #f4f5f9");
      $('#conversation').append("<li class='message-right'><div class='message-avatar'><div class='avatar ion-ios-person'></div><div class='name'>You</div></div><div class='message-text'>" + text + "</div><div class='message-hour'>" + d + " <span class='ion-android-done-all'></span></div></li>");
      $('#message').val('');
      $('.widget-conversation').scrollTop($('ul li').last().position().top + $('ul li').last().height());
    } else {
      $('#message').css("border", "1px solid #eb9f9f");
      $('#message').animate({opacity: '0.1'}, "slow");
      $('#message').animate({opacity: '1'}, "slow");
      $('#message').animate({opacity: '0.1'}, "slow");
      $('#message').animate({opacity: '1'}, "slow");
    }
  });
  
});
              
            
!
999px

Console