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(ng-app='MyApp'
ng-controller='AppCtrl')
  div#menubar
    div.logo
      a(href="#")
        img(src="https://i.imgur.com/RRtNnOs.png")

    ul.middle
      div.r1 Project Name <i class="glyphicon glyphicon-pencil"></i>
      ul.r2
        li.dropdown
          button.dropdown-btn(href='#'
          data-toggle='dropdown') File
          ul.dropdown-menu
            li
              a(href='#') Action 1
            li
              a(href='#') Action 2
            li
              a(href='#') Action 3
         li.dropdown
           button.dropdown-btn(href='#'
           data-toggle='dropdown') Edit
           ul.dropdown-menu
             li
               a(href='#') Action 1
             li
               a(href='#') Action 2
             li
               a(href='#') Action 3
         li.dropdown
           button.dropdown-btn(href='#'
           data-toggle='dropdown') Help
           ul.dropdown-menu
             li
               a(href='#') Action 1
             li
               a(href='#') Action 2
             li
               a(href='#') Action 3

    div.menu-btns
      button#comment-btn <i class="material-icons">assignment</i> <span>Comment</span>
      button#share-btn <i class="material-icons">supervisor_account</i> <span>Share</span>
      button#chat-btn(ng-click='openChatDialog()') <i class="material-icons">chat</i> <span>Chat</span>

    button#user-btn
    div#user-drop.shadow-1
      ul
        li Smile
        li You
        li Goodlookin
        li Get Shwify
        li Cellar Door Is Beautiful
        hr
        li Your Profile
        ul.links
          li Link1
          li Link2
          li Link3
  div#chat-cntnr
    div.chat-box(ng-repeat='chat in chat.openChats')
      div.chat-header
        span.chat-title {{chat}}
        button.chat-h-btn.chat-close(ng-click='closeChat()')
          i.glyphicon.glyphicon-remove
      textarea#chat-input
              
            
!

CSS

              
                $codepen-btn-grey: #343436
$codepen-hover-grey: #4d4d50
$codepen-icon-grey: #aeaeae
$codepen-dropdown-grey: #e7e7e7

html, body
  padding: 0
  margin: 0
  height: 100%
  width: 100%
  
  ul
    padding: 0
    margin: 0

#menubar
  font-family: sans-serif
  background-color: black
  display: flex
  position: relative
  white-space: nowrap
    
  .logo
    display: flex
    align-items: center
    padding: 10px
    background-color: lightGrey
    img
      height: 40px
    
  .middle
    padding: 10px
    padding-top: 8px
    padding-bottom: 0px
    color: white
    width: 100%
    position: relative
    font-family: inherit
    margin-left: 8px
    margin-right: 20px
    
    .r1 
      font-size: 20px
      i
        position: relative
        top: -1px
        font-size: 12px
        font-weight: 700
        margin-left: 2px
        cursor: pointer
        &:hover
          color: lightGrey
      
    .r2
      margin-top: 2px
      margin-left: -6px
      font-size: 15px
      padding-bottom: 6px
      li
        display: inline-block
        
    .dropdown-btn
      position: relative
      outline: 0
      background-color: transparent
      border: none
      cursor: pointer
      padding: 2px 6px
      z-index: 100
      margin: 0 1px
      margin-top: 1px
      &:hover
        background-color: grey
    
    .open
      .dropdown-btn
        background-color: black
        margin: 0 !important
        border: white 1px solid
        border-bottom: none
        
      
    .dropdown-menu
      background-color: black
      border: white 1px solid
      border-radius: 0
      margin-top: -1px
      z-index: 10
      li
        display: block
      a
        color: white
        &:hover
          background-color: dodgerBlue
      
  
  .menu-btns
    display: flex
    margin: 12px
    margin-right: 0px
    color: white
    right: 0
    button
      outline: 0
      position: relative
      background-color: transparent
      border-radius: 2px
      border: $codepen-btn-grey 3px solid
      margin: 0 5px
      padding: 2px 12px
      font-size: 15px
      white-space: nowrap
      &:hover
        background-color: $codepen-hover-grey
      
      i
        position: relative
        top: 5px
        color: $codepen-icon-grey
      span
        position: relative
        top: -3px
  
#user-btn
  margin: 10px
  margin-bottom: 8px
  outline: 0
  width: 70px
  background: url('https://www.fillmurray.com/70/92')
  border: none
  border-radius: 2px
  
#chat-btn
  background-color: $codepen-btn-grey !important
  &:hover
    background-color: $codepen-hover-grey !important

.shadow-1 
  box-shadow: 0 2px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)
  transition: all 0.2s ease-in-out

// USER DROP
#user-drop
  display: none
  position: absolute
  right: 0
  top: 100%
  background-color: white
  z-index: 10

  ul
    list-style-type: none
    padding: 6px 0
    padding-bottom: 2px
    font-size: 15px
    font-weight: 500
    li
      cursor: pointer
      padding: 4px 16px
      padding-right: 38px
      &:hover
        background-color: $codepen-dropdown-grey
    hr 
      margin: 8px 0
      border-top: black 1px solid
    .links
      padding-top: 0
      li
        display: inline-block
        padding-right: 2px
        font-size: 11px
        color: darkGrey
        &:hover
          background-color: white
          color: black

#user-drop.open
  display: initial
// user drop

// CHAT DIALOG  
md-dialog
  position: absolute
  right: 25px
  top: 80px
  
  svg
    position: absolute
    left: 16px
    top: 11px
// chat
    
// CHAT
#chat-cntnr
  display: none
  position: fixed
  bottom: 0
  right: 0
  .chat-box
    height: 150px
    width: 150px
    background-color: lightGrey
    border: 1px solid #bfbfbf
    margin: 0 4px
    position: relative
  .chat-box:last-child
    margin-right: 0
  
  // CHAT HEADER
  .chat-h-btn
    padding: 2px 8px
    border-radius: 4px
    font-size: 10px
    background-color: #343436
    color: white
    border: black 1px solid
    position: absolute
    top: 4px
    &:hover
      background-color: #4d4d50
  .chat-close
    right: 5px
  .chat-header 
    position: relative
    padding: 3px
    border-bottom: #bfbfbf 1px solid
    background-color: #1a1b1c
    color: #ccc
    font-weight: 900
    font-size: 16px
  // chat header
  
// chat input
#chat-input
  position: absolute
  bottom: 1px
  right: 1px
  width: 99%
  resize: none
//CHAT
    
              
            
!

JS

              
                angular.module('MyApp', ['ngMaterial', 'ngMessages', 'material.svgAssetsCache'])

.controller('AppCtrl', function($scope, $mdDialog) {

  //CHAT
  $scope.chat = {};
  $scope.chat.openChats = [];
  $scope.collaborators = ['Dan', 'Miles', 'Ryan', 'kevin'];
  
  var chatCntnr = document.getElementById('chat-cntnr');

  // open a chat box
  var isChatOpen = function(user) {
    if ($scope.chat.openChats.indexOf(user) < 0) return false;
    else return true;
  };

  $scope.openChat = function(user) {
    if (!isChatOpen(user)) {
      if (chatCntnr.style.display !== 'flex') {
        chatCntnr.style.display = 'flex';
      }
      $scope.chat.openChats.push(user);
    }
    $mdDialog.hide();  
  };
  
  // close a chat box
  $scope.closeChat = function(user) {
      $scope.chat.openChats.splice($scope.chat.openChats.indexOf(user), 1);
  };

  // CHAT DIALOG
  $scope.openChatDialog = function() {
    $mdDialog.show({
      scope: $scope,
      preserveScope: true,
      template: '<md-button ng-click="openChat(\'everybody\')">Everybody</md-button><md-button ng-repeat="user in collaborators" ng-click="openChat(user)"><svg class="status-light" height="17" width="17"><circle cx="8" cy="8" r="8" fill="lightGreen" /></svg>{{user}}</md-button>',
      hasBackdrop: false,
      clickOutsideToClose: true,
      openFrom: '#chat-btn',
      closeTo: '#chat-btn'
    })
  };
});
// chat dialog
// chat

/**
 * MENUBAR
 */
var dropdownBtns = document.querySelectorAll('.middle .dropdown-btn');
var dropdowns = document.querySelectorAll('.middle .dropdown');
var userBtn = document.getElementById('user-btn');
var userDrop = document.getElementById('user-drop');

document.addEventListener('click', (e) => {
  if (userDrop.classList.contains('open')) {
    userDrop.classList.toggle('open');
  }
});

userBtn.addEventListener('click', (e) => {
  userDrop.classList.toggle('open');
  e.stopPropagation();
})

for (var i = 0; i < dropdownBtns.length; i++) {
  (function() {
    var dropdownBtn = dropdownBtns[i];
    var k = i;
    dropdownBtn.addEventListener('mouseover', () => {
      var x = isDropOpen();
      if (x > -1 && x !== k) {
        dropdowns[x].classList.toggle('open');
        dropdowns[k].classList.toggle('open');
      }
    })
  })();
}

var isDropOpen = () => {
  for (var i = 0; i < dropdowns.length; i++) {
    var dropdownClasses = dropdowns[i].classList;
    if (dropdownClasses.contains('open')) return i;
  }
  return -1;
}

/**
 * menubar
 */
              
            
!
999px

Console