Pen Settings



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


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.


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.


                <div class="container text-center" id="calc">
  <div class="calcBG text-center">
    <div class="row" id="result">
      <form name="calc">
        <input class="screen text-right" name="result" readonly="" type="text" />
    <div class="row">
      <button class="btn btn-danger" id="allClear" onclick="clearScreen()" type="button">AC</button>
      <button class="btn btn-warning" id="clear" onclick="clearScreen()" type="button">CE</button>
      <button class="btn btn-info" id="%" onclick="myFunction(" type="button">%</button>
      <button class="btn btn-info" id="/" onclick="myFunction(" type="button">÷</button>
    <div class="row">
      <button class="btn btn-info" id="7" onclick="myFunction(" type="button">7</button>
      <button class="btn btn-info" id="8" onclick="myFunction(" type="button">8</button>
      <button class="btn btn-info" id="9" onclick="myFunction(" type="button">9</button>
      <button class="btn btn-info" id="*" onclick="myFunction(" type="button">x</button>
    <div class="row">
      <button class="btn btn-info" id="4" onclick="myFunction(" type="button">4</button>
      <button class="btn btn-info" id="5" onclick="myFunction(" type="button">5</button>
      <button class="btn btn-info" id="6" onclick="myFunction(" type="button">6</button>
      <button class="btn btn-info" id="-" onclick="myFunction(" type="button">-</button>
    <div class="row">
      <button class="btn btn-info" id="1" onclick="myFunction(" type="button">1</button>
      <button class="btn btn-info" id="2" onclick="myFunction(" type="button">2</button>
      <button class="btn btn-info" id="3" onclick="myFunction(" type="button">3</button>
      <button class="btn btn-info" id="+" onclick="myFunction(" type="button">+</button>
    <div class="row">
      <button class="btn btn-info" id="0" onclick="myFunction(" type="button">0</button>
      <button class="btn btn-info" id="." onclick="myFunction(" type="button">.</button>
      <button class="btn btn-success" id="equals" onclick="calculate()" type="button">=</button>
      <button class="btn btn-info" id="blank" type="button">&nbsp;</button>

  border: none;
button {
  height: 50px;
  width: 50px;
  margin: 10px 4px;
  box-shadow: inset 1px 1px 50px  #0066FF;
  border: none !important;
*:focus {
    outline: 0 !important;
#allClear {
  box-shadow: inset 1px 1px 50px  #990000;
  border: none;
#clear {
  box-shadow: inset 1px 1px 50px  #CC6600;
  border: none;
  box-shadow: inset 1px 1px 50px #006633;
  border: none;
/* Hidden button for formatting sake */
#blank {
  visibility: hidden;
.calcBG {
  width: 380px;
  background-color: LemonChiffon;
  border-radius: 0px;
  border:3px ridge gold;
  padding: 20px;
  margin-top: 10px;
  margin-bottom: 50px;
  box-shadow: inset 1px 1px 50px #000;
  margin: 25vh auto;
.screen {
  height: 30px;
  border-radius: 0px;
  border:3px ridge white;
  padding: 10px;
  margin: 10px 2px;
  font-size: 18px;
  font-weight: bold;

background: #8e9eab; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #8e9eab , #eef2f3); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #8e9eab , #eef2f3); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
  box-shadow: 0px 4px  #000099 inset;
small {
  color: #fff;
  font-weight: bold;


// Determines button clicked via id
function myFunction(id) {

// Clears calculator input screen
function clearScreen() {
// Calculates input values
function calculate() {
  try {
    var input = eval(document.calc.result.value);
  } catch(err){