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.


                <div class="calculator">
  <div class="boxAnswer">
  <div class="clear">C</div>
  <span class='num'>7</span>
  <span class='num'>8</span>
  <span class='num'>9</span>
  <span class="ops">/</span>
  <span class='num'>4</span>
  <span class='num'>5</span>
  <span class='num'>6</span>
  <span class="ops">*</span>
  <span class='num'>3</span>
  <span class='num'>2</span>
  <span class='num'>1</span>
  <span class="ops">+</span>
  <span class='num'>0</span>
  <span class='total'>=</span>
  <span class="ops">-</span>



                * {
  border-box: box-sizing;

.calculator {
  width: 400px;;
  margin: 100px auto 0 auto;
  height: 274px;
  border: 2px solid black;
  background-color: #10b29a;
  border-radius: 10px;

/*Used percentages for seperation for easy math instead of fixed width*/
.boxAnswer {
  width: 71.5%;
  border: 1px solid;
  height: 50px;
  float: left;
  line-height: 100%;
  background-color: white;
  margin: 2px 1.5%;

.clear {
  float: left;
  width: 22.5%;
  background-color: red;
  border: 1px solid red;
  margin: 2px 1.5%;

span {
  float: left;
  width: 22%;
  background-color: black;
  margin: 2px 1.5%;

span, .clear {
  text-align: center;
  line-height: 40px;
  height: 50px;
  color: white;
  border-radius: 20px;
  cursor: pointer;

.ops {
  background-color: skyblue;

  color: yellow;



//use eval method for operators
//get the value of numbers inputed to div
//be able to evaulate values using operators
function calculations (){

//when clicking number buttons, append them to the calculator

$('.num, .ops').click(function(){
  var $getNumbers = $(this).text();
  $('.boxAnswer p').append($getNumbers);

//create a clear function where it clears all numbers from calculator
function clear(){
    $('.boxAnswer p').text('');