Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div class="container">
	<div class="d-flex vh-100">
		<div class="the-calculator col-md-6 m-auto bg-secondary border border-secondary rounded">
		<div class="output bg-dark mt-3 w-100 border border-secondary rounded text-light text-right"></div>
		<div class="buttons container-fluid bg-light mt-3 pt-3">
			<div class="row mt-3">
				<div class="col-3"></div>
				<div class="col-3"></div>
				<div class="col-3"><span class="btn btn-danger btn-of-calc cee text-light">C</span></div>
				<div class="col-3"><span class="btn btn-warning btn-of-calc symbol text-light">/</span></div>
			</div>
			<div class="row mt-3">
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">7</span></div>
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">8</span></div>
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">9</span></div>
				<div class="col-3"><span class="btn btn-danger btn-of-calc symbol text-light">-</span></div>
			</div>
			<div class="row mt-3">
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">4</span></div>
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">5</span></div>
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">6</span></div>
				<div class="col-3"><span class="btn btn-primary btn-of-calc symbol text-light">*</span></div>
			</div>
			<div class="row mt-3">
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">1</span></div>
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">2</span></div>
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">3</span></div>
				<div class="col-3"><span class="btn btn-success btn-of-calc symbol text-light">+</span></div>
			</div>
			<div class="row mt-3">
				<div class="col-3"><span class="btn btn-dark btn-of-calc nums text-light">0</span></div>
				<div class="col-3"><span class="btn btn-dark btn-of-calc dot text-light">.</span></div>
				<div class="col-3"><span class="btn btn-info btn-of-calc result text-light">=</span></div>
				<div class="col-3"></div>
				<div class="col-3"></div>
			</div>
		</div>
		<div class="text-center mt-3">
		<h4 class="text-success">Dev. By: Nadeem Gorsi</h4>
	</div>

	</div>
	</div>
	
</div>
              
            
!

CSS

              
                * {
	font-family: "Gugi", cursive;
}

.the-calculator {
	height: 510px;
	background: url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRTBGDiNePr5ItqZ3LY_3FgC6qIVQYhQDlXF3lg4eb6ozFi156ApQ);
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
}

.output {
	height: 80px;
}

.buttons {
	height: 75%;
}

.btn-of-calc {
	width: 100%;
	height: 48px;
	line-height: 48px;
	padding: 0;
	font-size: 25px;
	font-weight: bold;
	box-shadow: 0px 17px 10px -10px rgba(0, 0, 0, 0.4);
}

.btn-of-calc:active {
	box-shadow: none;
}

.output {
	font-size: 45px;
	padding-right: 8px;
}
.vh-100 {
	height: 100vh;
}

              
            
!

JS

              
                //build a calculator...
var operators = [".", "+", "*", "-", "/"];
$(".cee").click(function() {
	//clear and reset everything...
	$(".output").html("");
});
$(".nums").click(function() {
	$(".output").html($(".output").html() + "" + $(this).html());
});
$(".dot").click(function() {
	if (
		$(".output")
			.html()
			.indexOf(".") === -1
	) {
		$(".output").html($(".output").html() + "" + $(this).html());
	}
});
$(".symbol").click(function() {
	if (
		!operators.includes(
			$(".output")
				.html()
				.charAt($(".output").html().length - 1)
		)
	) {
		$(".output").html($(".output").html() + "" + $(this).html());
	}
});
$(".result").click(function() {
	if (
		$(".output")
			.html()
			.indexOf(".") === -1
	) {
		$(".output").html(eval($(".output").html()));
	} else {
		$(".output").html(eval($(".output").html()).toFixed(2));
	}
});

              
            
!
999px

Console