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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.



<br />
<div id="surrounding">
<div id="case">
  <div id="top-section">
    <div class="logo-left text-center">BUSICON</div>
    <div class="logo-right text-center">handi</div>
  <div id="panel-bottom">
    <div id="display-border">
<div id="led-display">
  <div id="d0" class="led-digit led-on">0</div>
  <div id="d1" class="led-digit led-off">8.</div>
  <div id="d2" class="led-digit led-off">8.</div>
  <div id="d3" class="led-digit led-off">8.</div>
  <div id="d4" class="led-digit led-off">8.</div>
  <div id="d5" class="led-digit led-off">8.</div>
  <div id="d6" class="led-digit led-off">8.</div>
  <div id="d7" class="led-digit led-off">8.</div>
  <div id="dN" class="led-digit led-off">-</div>
</div> <!-- LED display -->
    </div> <!-- LED display border -->
  </div> <!-- brushed metal panel -->
  </div> <!-- top section -->
  <div style="height: 10px"></div>
<div id="btn-enclosure" class="container-fluid">
<!-- it may be better to do these rows as button groups 
      need to clean the divs up anyway-->
    <div class="column"><button id="n7" class="num-btn"><p>7</p></button></div>
    <div class="column"><button id="n8" class="num-btn"><p>8</p></button></div>
    <div class="column"><button id="n9" class="num-btn"><p>9</p></button></div>
    <div class="column"><button id="oX" class="op-btn"><p>X</p></button></div>
    <div class="column"><button id="n4" class="num-btn"><p>4</p></button></div>
    <div class="column"><button id="n5" class="num-btn"><p>5</p></button></div>
    <div class="column"><button id="n6" class="num-btn"><p>6</p></button></div>
    <div class="column"><button id="oD" class="op-btn"><p>÷</p></button></div>
    <div class="column"><button id="n1" class="num-btn"><p>1</p></button></div>
    <div class="column"><button id="n2" class="num-btn"><p>2</p></button></div>
    <div class="column"><button id="n3" class="num-btn"><p>3</p></button></div>
    <div class="column"><button id="oS" class="op-btn"><p>-=</p></button></div>

    <div class="column"><button id="n0" class="num-btn"><p>0</p></button></div>
    <div class="column"><button id="nP" class="num-btn"><p>.</p></button></div>
    <div class="column"><button id="oC" class="op-btn"><p>C</p></button></div>
    <div class="column"><button id="oA" class="op-btn"><p>+=</p></button></div>
</div> <!-- button enclosure -->
</div> <!-- case -->
  <br />

<h4 style="text-align: center; text-shadow: 0px 0px 30px white;">Learn about <a href="" target="_blank">the real Busicom Handy</a> and<br /><a href="" target="_blank">Busicom's instrumental role in Intel's early history.</a></h4>


                body, html {
  background-color: black;
  padding: 0px;
  margin: 0px;
  background-color: #a0a0a0;

#case {
  width: 296px;
  padding: 8px 3px 3px 3px;
  border-radius: 7px;
  margin: 0 auto;
  background-color: #101316;
  box-shadow: 6px 7px 15px 1px #101316;

#top-section {
  width: 100%;
  border-style: solid;
  border-color: #101316;
  border-width: 2px;
  border-radius: 7px;
  background: url( left top repeat;

.logo-left {
  height: 50px;
  width: 46%;
  float: left;
  text-align: center;
  font-family: 'Dhurjati', sans-serif;
  font-size: 25px;
  padding-top: 10px;

.logo-right {
  height: 50px;
  width: 54%;
  float: right;
  text-align: left;
  font-family: 'Gruppo';
  font-size: 50px;
  margin-top: -10px;

#panel-bottom {
  width: 100%;
  justify-content: center;
  padding-top: 10px;
  padding-bottom: 20px;

#display-border {
  background-color: #262930;
  width: 93%;
  height: 78px;
  border-radius: 3px;
  box-shadow: 6px 6px 6px -4px black inset;

#led-display {
  background: #1e1616;
  height: 35px;
  margin: 20px;

.led-digit {
  font-family: 'Rationale', sans-serif;
  font-size: 24px;
  text-align: center;
  float: right;
  width: 25px;
  margin-top: 1px;

.led-on {
  color: #ff4f3f;
  background-color: #7a261d;
  text-shadow: 1px 0px 6px red;
  box-shadow: 0px 0px 15px 10px #2b1d1c inset;

.led-off {
  color: #3a2624;
  background-color: #2b1d1c;

#btn-enclosure {
  width: 100%;
  border-style: solid;
  border-color: #101316;
  border-width: 2px;
  border-radius: 3px;
  background-color: #262930;
  background: url( left top repeat;
  padding: 0px 10px 20px 10px;

button {
  font-family: 'Chathura', sans-serif;
  font-weight: bold;
  font-size: 30px;
  height: 32px;
  width: 45px;
  border-radius: 6px;
  box-shadow: 1px 1px 6px 2px black;
  border-width: 1px;
  border-color: #9d9fa5;

button:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 3px 1px black;
  border-color: #252c33;

button:focus {
  outline: none;

.op-btn {
  color: white;
  background-color: #62bbdd;
  border-color: #62bbdd;

.num-btn {
  color: black;
  background-color: #f7f9ee;
  border-color: silver;

.column {
  width: 48px;
  float: left;
  margin-left: 15px;
  padding-top: 20px;

p {
  margin: -7px;


                /* This design was inspired by the Busicom LE-80A Handy, a very early pocket calculator sold in the 70s. It has an unusual key layout, lacking a dedicated equals key. There are eight, seven-segment LED digit displays and a ninth display for error flags and the negative indicator.

var inputBuffer = [];   // display inputBuffer
var memory = null;  // left argument
var operator = '';  // operator memory

$('button').click(function() {[0] === "n" ?
    pressNumber([1]) :
    performOperation([1], inputBuffer);

function pressNumber(num) {
  if (num === '0' && inputBuffer.length === 0) {return;}
  if (num === 'P') {
    if (inputBuffer.indexOf('.') !== -1) {return;}
    if (inputBuffer.length === 0) inputBuffer.unshift('0')
    num = '.';
  if (inputBuffer.filter(char => char !== '.').length < 8 ) {

function performOperation(type, arr) {
  var number = parseFloat(arr.join(""));
  inputBuffer = [];
  if (type === 'C') {
    memory = null;
    operator = '';
  } else if (type === operator && memory != null) {
    switch (type) {
      case 'A':
        memory += number;
      case 'S':
        memory -= number;
      case 'X':
        memory *= number;
      case 'D':
        memory /= number;
  } else if (type !== operator && memory != null) {
      performOperation(operator, arr);
      operator = type;
  } else {
    operator = type;
    memory = number;

function convertToDisplay(float) {
  var ans = []
  if (float > 99999999 || float < -99999999) {
    ans = ['E'];
  } else {
    ans = Math.abs(float)
              .toFixed(7) // BUG: can display rounding error when chaining operations
              .replace(/[0]+$/g, "") // suppress trailing zeros caused by floating point error
  updateDisplay(ans, float < 0 ? true : false);

function updateDisplay(digitArr, neg){
  digitArr = digitArr.reduce(function(a, b, index) {
          b === '.' ? a[index] += b : a.push(b);
          return a;
        }, [0]).reverse();
  if (neg === true) {$('#dN').removeClass('led-off').addClass('led-on');}

    for (var i = 0; i < digitArr.length - 1; i++) {
      $('#d' + i).html(digitArr[i]).removeClass('led-off').addClass('led-on')

function clearDisplay() {