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.

            
              <head>
<link href="//db.onlinewebfonts.com/c/b47cf1c379e95cf17ee45b63d6442400?family=Calculator+Digits" rel="stylesheet" type="text/css"/>
 
</head>
<div class="container">
  <div class="display font-fam"></div>
  <div class="numbers">
    <button class="operand top" id="CE">CE</button>
    <button class="operand top" id="multiply">*</button>
    <button class="operand top"id="divide">/</button>
    
    
    <button class="number" id="seven">7</button>
    <button class="number" id="eight">8</button>
    <button class="number" id="nine">9</button>
     <button class="operand right"id="clear">AC</button>
    
    <button class="number" id="four">4</button>
    <button class="number" id="five">5</button>
    <button class="number" id="six">6</button>
    <button class="operand right" id="minus">-</button>
    
    <button class="number" id="one">1</button>
    <button class="number" id="two">2</button>
    <button class="number" id="three">3</button>
    <button class="operand right"id="plus">+</button>
    
    
    <button class="number" id="zero">0</button>
    <button class="number" id="dot">.</button>
    <button class="operand right" id="enter">=</button>
    
    
 
    
 <!-- <div class="operands">
    <button class="operand"id="clear">AC</button>
    <button class="operand"id="plus">+</button>
    <button class="operand" id="minus">-</button>
    <button class="operand" id="multiply">*</button>
    <button class="operand"id="divide">/</button>
    <button class="operand" id="enter">=</button>
  </div> -->
    </div>
</div>
            
          
!
            
              @import url(//db.onlinewebfonts.com/c/b47cf1c379e95cf17ee45b63d6442400?family=Calculator+Digits);

@import 'https://fonts.googleapis.com/css?family=VT323';

@font-face {
    font-family: pixl;
    src: url(https://www.dropbox.com/s/hz3199saz0jr8vb/visitor1.ttf?dl=0);
}

body{
  text-align:center;
}
.container{
  border:none;
  width:300px;
  height: 400px;
  margin:50px 0 0 0;
  display:inline-block;
  background-color:black;
  border-radius:5px;
  box-shadow: 3px 4px 8px 0 rgba(0, 0, 0, 0.3), 0 6px 20px 0 rgba(0, 0, 0, 0.19), inset 0px 3px 5px 0px white;
}
.numbers{

  /*border:1px solid black;*/
  text-align:center;
 
}
.numbers{
  text-align:center;
  width: 250px;
  height:auto;
  margin-right:none;
  margin-top:10px;
  padding-top:none;
  display:inline-block;
  padding-right:0px;
  position:center;
  
  border:1px solid black;
  border-radius:5px;
}
.number{

  margin:3px 3px 3px 3px;
  padding:none;
  height:50px;
  width:50px;
  font-size:24px;
  background-color:white;
  border-width: 0 4px 5px 0;
  border-radius: 3px;
  background-clip: padding-box;  
  border-color: transparent #ddd #999 transparent;
}
.display{
  height:50px;
  width:225px;
  line-height:50px;
  box-shadow: inset 3px 5px 7px rgba(0,0,0,0.3);
  
  border-radius:5px;
  text-align:center;
  padding:none;
  display:inline-block;
  margin-top:20px;
  background-color:#DAEDBD;
  
}
button:active{
  width:47px;
  margin-right:6px;
  border-width: 0px 2px 3px 0px; 
  border-color: transparent #ddd #999 transparent;
  
  height:45px;
  position:relative;
  left:2px;
  top:3px;
}
#enter{
  height:50px;
  width:80px;
  background-color:#C3423F;
}
.operand{
  height:50px;
  width:50px;
  margin: 3px 3px 3px 3px;
  background-color:#7F796D;
  position:relative;
  border-width: 0 4px 5px 0;
  border-radius: 3px;
  background-clip: padding-box;  
  border-color: transparent #ddd #999 transparent;
  border-radius:3px;
  color:white;
 
}
.font-fam{
/*  font-family:'Calculator Digits';*/
  font-family: 'VT323', monospace;
  text-shadow: 2px 2px 3px/* #ff0000*/rgba(0,0,0,0.2);
  font-size:45px;
}
#zero{
  height:50px;
  width:80px;
  font-size:20px;
  padding:none;
  margin:none;
}
#dot{
  height:50px;
  width:50px;
}

.keys{
  border:1px solid black;
}
#divide{
  margin-right:54px;
}
#clear{
  margin-top:3px;
  float:right;
}
.right{
  float:right;
  margin-left:-6px;
  margin-right:6px;

}
button.right:active{
  margin-left:-6px;
  width:50px;
  position:relative;
  
  border-color: transparent #999 #999 transparent;
}
button:focus{
  outline:none;
}
            
          
!
            
              $( document ).ready(function() {
  
  var result = "";
  var equation = [];
  
  //if clicked on a number, add element to var result
  $(".number").click(function(){
    result += $(this).html();
    $(".display").html(result);
  });
  
  //if clicked on an operand, push result to array to be calculated
  $(".operand").click(function(){
    
    //clear empties the array and result.
    if($(this).html()==="AC"){
      result = "";
      equation = [];
      $(".display").html(equation);
    }
    //enter calculates the values in the array using js eval()
    else if($(this).html()==="="){
      //Calculate equation
      equation.push(result);
      result = eval(equation.join(""));
      equation = [];
      $(".display").html(result);
    }
    //if an operator is clicked, push result to array with the operator
    else {
      equation.push(result);
      equation.push($(this).html());
      result = "";
      $(".display").html(equation);
    }
  })
  
});
            
          
!
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