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


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


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.


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.


                <div class="moveright" align="right">
<div class="calculator">
  <p id="title">FreeCodeCamp</p>
  <p id="tagline">HandCoded Calculator</p>
  <input type="text" disabled="disabled" id="display"/>
  <div class="row">
    <button class="ctrl" onClick="allClearAC()">AC</button>
    <button class="ctrl" onClick="clearCE()">CE</button>
    <button onClick="operate('/100')">%</button>
    <button onClick="operate('/')">÷</button>
  <div class="row">
    <button onClick="addDigit(7)">7</button>
    <button onClick="addDigit(8)">8</button>
    <button onClick="addDigit(9)">9</button>
    <button onClick="operate('*')">x</button>
  <div class="row">
    <button onClick="addDigit(4)">4</button>
    <button onClick="addDigit(5)">5</button>
    <button onClick="addDigit(6)">6</button>
    <button onClick="operate('-')">-</button>
  <div class="row">
    <button value=1 onClick="addDigit('1')">1</button>
    <button onClick="addDigit('2')">2</button>
    <button onClick="addDigit('3')">3</button>
    <button class="tall" onClick="operate('+')">+</button>
  <div class="row">
    <button onClick="addDigit('0')">0</button>
    <button onClick="addDigit('.')">.</button>
    <button onClick="workout()">=</button>


                @import url(|Open+Sans|Montserrat);
body, html {
   background:url("")no-repeat fixed;
  margin-top: 8%;

.calculator {
  width: 250px;
  height: 335px;
  background-color: #F3EEE7;
  margin: 0 auto;
  border-top-left-radius: 80% 20px;
  border-top-right-radius: 80% 20px;
  border-bottom-left-radius: 80% 20px;
  border-bottom-right-radius: 80% 20px;
  box-shadow: inset 5px 0 10px -5px #635e61, inset -5px 0 10px -5px #635e61, inset 0px -5px 10px -2px #635e61, 0 0 1px 2px #635e61, 0 10px 20px 0 #494547;
  text-align: center;
.calculator p#title {
  padding-top: 10px;
  margin-bottom: -10px;
  color: #7d777b;
  font-family: 'Pacifico';
.calculator p#tagline {
  text-transform: uppercase;
  color: #969194;
  font-family: 'Open Sans';
  font-size: .7em;
.calculator input[type='text'] {
  background-color: #C7C7B0;
  border: 1px solid #b2b292;
  line-height: 40px;
  width: 80%;
  font-size: 2em;
  text-align: right;
  font-family: 'Montserrat';
  padding-right: 10px;
  margin-bottom: 20px;
  border-radius: 5px;
  box-shadow: inset 0px -2px 10px #b2b292;
.calculator input[type='text']:focus {
  outline: none;
.calculator .row {
  display: block;
.calculator .row button {
  width: 40px;
  height: 30px;
  border: 1px solid #4B4657;
  border-top: 2px solid #7c748f;
  background-image: -webkit-linear-gradient( top , #4B4657, #332f3b);
  background-image: linear-gradient(to bottom, #4B4657, #332f3b);
  color: white;
  font-size: 1.1em;
  border-radius: 20%;
  border-top-left-radius: 80% 10px;
  border-top-right-radius: 80% 10px;
  border-bottom-left-radius: 100% 10px;
  border-bottom-right-radius: 100% 10px;
  margin-left: 5px;
  margin-right: 5px;
  margin-bottom: 8px;
  box-shadow: inset 0 1px 4px #7c748f, inset 0 -4px 20px #332f3b, 0 3px 1px 0 #332f3b;
.calculator .row button:focus {
  outline: 0;
.calculator .row button:active {
  background-image: -webkit-linear-gradient( bottom , #4B4657, #332f3b);
  background-image: linear-gradient(to top, #4B4657, #332f3b);
.calculator .row .ctrl {
  border: 1px solid #CC4E5F;
  border-top: 2px solid #e39da7;
  background-image: -webkit-linear-gradient( top , #CC4E5F, #b33445);
  background-image: linear-gradient(to bottom, #CC4E5F, #b33445);
  box-shadow: inset 0 1px 4px #e39da7, inset 0 -4px 20px #b33445;
.calculator .row .ctrl:active {
  background-image: -webkit-linear-gradient( bottom , #CC4E5F, #b33445);
  background-image: linear-gradient(to top, #CC4E5F, #b33445);
.calculator .row .tall {
  height: 65px;
  float: right;
  margin-right: 24px;
  margin-left: -8px;



                // Caculator
var memory = '';
var current = '';
var MAX = '10';
var op = '';
var display = document.getElementById("display");
var lasData = [];

function allClearAC(){ 
  memory = '';
  current = '';
  op = '';
  display.value = current;
}  // Clear all the digits on screen
function clearCE(){
  memory =  memory.substr(0, memory.length-1);
  display.value = memory;

function addDigit(dig){
  if ( current.length > MAX) { 
    current = "Too Large"
    display.value = current;
    } else {current = dig;}
    memory = memory + current;
    display.value = memory;

function operate(op){
  memory = memory + op; 
  current = '';
  display.value = memory;

function workout(){
    current = eval(memory);
    display.value = current; 
    oper = 0;
    memory= '';