cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

  <link href="https://fonts.googleapis.com/css?family=Orbitron" rel="stylesheet">

  <div class="calculator">
      <h3>FCC Calculator</h3>
        <div id="display"></div>
 <table class="grid">
    <tr class="spaceUnder">
        <td><button class="btn-red" id="AC" onclick="AC()">AC</button></td>
        <td><button class="btn-red" id="CE" onclick="CE()">CE</button></td>
        <td><button id="%" onclick="number(id)">%</button></td>
        <td><button id="/" onclick="number(id)">/</button></td>
    <tr class="spaceUnder">
        <td><button id="7" onclick="number(id)">7</button></td>
        <td><button id="8" onclick="number(id)">8</button></td>
        <td><button id="9" onclick="number(id)">9</button></td>
        <td><button id="*" onclick="number(id)">*</button></td>
    <tr class="spaceUnder">
        <td><button id="4" onclick="number(id)">4</button></td>
        <td><button id="5"  onclick="number(id)">5</button></td>
        <td><button id="6" onclick="number(id)">6</button></td>
        <td><button id="-"  onclick="number(id)">-</button></td>
    <tr class="spaceUnder">
        <td><button id="1"  onclick="number(id)">1</button></td>
        <td><button id="2" onclick="number(id)">2</button></td>
        <td><button id="3" onclick="number(id)">3</button></td>
        <td><button id="+" onclick="number(id)">+</button></td>
        <td><button id="0" onclick="number(id)">0</button></td>
    <td><button onclick="number('.')">.</button></td></tr>
        <div><button  class="wide" id="=" onclick="equals()">=</button></td>

              body {
  text-align: center;

.grid {
  position: relative;
  top: 50px;
  left: 12px;
  width: 300px;

tr.spaceUnder > td
  padding-bottom: .75em;

button {
  background: #EEEEEE;
  color: black;
  text-align: center;
  border-radius: 8px;
  width: 50px; height: 50px;
  font-size: 36px;

.btn-red {
  background: #9F000F;
  color: white;
  width: 60px;

  width: 100px;
  position: relative;
  left: 90px;
  top: -4px;

#display {
  position: absolute;
  width: 300px;  
  height: 40px;
  margin-left: 4px;
  top: 54px;
  color: #555555;
  font-size: 34px;
  text-align: right;
  font-family: 'Orbitron', sans-serif;
  font: unicode;
  background: #CCCCCC;
  border-radius: 8px;
  padding: 8px;
  box-shadow: inset 0 0 10px #777777;

.calculator {
  border: 1px;
  border-spacing: 2px;
  background: #777;
  display: inline-block;
  padding: 10px;
  border-radius: 10px;
  box-shadow: inset 0 0 16px #111111;
  position: absolute;
  height: 450px;
  width: 325px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

var arr=[]; // global array
var content="";
var justDidIt = 0;

function AC(){  

function CE(){
  for (var i=0; i<arr.length; i++)
    if (arr[i] == "+" ||  "-" ||  "*" ||  "/" ||  "%")
      var idx = arr.indexOf(i);

function mod(){

function equals(){
  var answer = eval(content);
  arr = [];

function number(val){
  if (justDidIt)
  content = document.getElementById('display').textContent;
  arr=content; // feed the string into the array

Loading ..................