Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <html>
  <head>
    
  </head>
  <body>
    <div class="calculator">
      <div class="title">MrAusCalc.exe</div>
      
      <div class="float" id="input"></div>
      
      <div class="button float clear CE">CE</div>

      <div class="button float clear Seven">7</div>
      <div class="button float Eight">8</div>
      <div class="button float Nine">9</div>
      <div class="button float Divide">÷</div>

      <div class="button float clear Four">4</div>
      <div class="button float Five">5</div>
      <div class="button float Six">6</div>
      <div class="button float Multiply">×</div>

      <div class="button float clear One">1</div>
      <div class="button float Two">2</div>
      <div class="button float Three">3</div>
      <div class="button float Minus">−</div>

      <div class="button float clear Zero">0</div>
      <div class="button float Period">.</div>
      <div class="button float Equals">=</div>
      <div class="button float Add">+</div>
    </div>
  </body>
</html>
              
            
!

CSS

              
                .float {
  float:left;
}
.clear {
  clear:both;
}

.calculator {
  background-color: gray;
  width: 280px;
  height: 450px;
  margin: auto;
  border-radius: 10px;
}

.calculator #input {
  width: 250px;
  margin: 50px 10px 10px 10px;
  font-family: Arial;
  font-size: 20px;
  height: 20px;
  background-color: #EEEEEE;
  padding: 5px;
}

.calculator .button {
  width: 50px;
  height: 50px;
  text-align: center;
  line-height: 50px;
  margin: 10px;
  font-family: Arial;
  font-size: 20px;
  background-color: LightGray;
  cursor: pointer;
}

.calculator .CE {
  background-color: Orange;
}

.calculator .title {
  position: absolute;
  font-family: Arial;
  font-size: 20px;
  width: 260px;
  text-align: center;
  z-index: 999;
  padding: 10px;
  color: #555555; 
}
              
            
!

JS

              
                function buttonClick() {
  //var button = $(this.target).text();
  //$("#input").text(button);
  //console.log(button);
}

$('.CE').click(function(){
  $("#input").text("");
})
$('.C').click(function(){
  $("#input").text("");
})
$('.Percent').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Divide').click(function(){
  $("#input").text($("#input").text() + "/");
})

$('.Seven').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Eight').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Nine').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Multiply').click(function(){
  $("#input").text($("#input").text() + "*");
})

$('.Four').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Five').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Six').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Minus').click(function(){
  $("#input").text($("#input").text() + "-");
})

$('.One').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Two').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Three').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Add').click(function(){
  $("#input").text($("#input").text() + "+");
})

$('.Zero').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Period').click(function(){
  $("#input").text($("#input").text() + $(this).text());
})
$('.Equals').click(function(){
  var sum = eval($("#input").text());
  $("#input").text(sum);
  
})
              
            
!
999px

Console