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

              
                <!DOCTYPE html>
<html>
	<head>
		<title>CALCUMAX</title>
		<link rel="stylesheet" type="text/css" href="css/index.css">
		<script type="text/javascript" src="./calculator.js" async="async"></script>
	</head>
	<body>
		<!-- The body of the calculator -->
		<div class="calc">
			<h2 style="font-family: Verdana, serif; font-weight: bolder;">CALCUMAX</h2>
			
			<div id="screen">
				<!-- This is where the input and output shows -->
				<h2 id="output"></h2>

			</div>

			<button value="CLEAR" id="clear" onclick="clearClicked()">CLEAR</button>

<!-- 		This is where the operands are: +,*, etc -->
			<div id="operands">
				<button class="opera" value="%" onclick="isclicked('%')">%</button> <br>
				<button class="opera" value="*" onclick="isclicked('*')">*</button> <br>
				<button class="opera" value="/"  onclick="isclicked('/')">/</button> <br>
				<button class="opera" value="-"  onclick="isclicked('-')">-</button> <br>

			</div>
			<!-- This is where the figures are located	 -->
			<div id="numbers">
				<button class="figures" value="7"  onclick="isclicked('7')">7 </button>
				<button class="figures" value="8"  onclick="isclicked('8')">8</button>
				<button class="figures" value="9"  onclick="isclicked('9')">9</button> <br>
				<button class="figures" value="4"  onclick="isclicked('4')">4</button>
				<button class="figures" value="5"  onclick="isclicked('5')">5</button>
				<button class="figures" value="6"  onclick="isclicked('6')">6</button> <br>
				<button class="figures" value="1"  onclick="isclicked('1')">1</button>
				<button class="figures" value="2"  onclick="isclicked('2')">2</button>
				<button class="figures" value="3"  onclick="isclicked('3')">3</button> <br>
				<button class="figures" value="0"  onclick="isclicked('0')">0</button>
				<button class="figures" value="."  onclick="isclicked('.')"><strong>.</strong></button>
				<span><button value="+" onclick="isclicked('+')">+</button> </span>
			</div>	
			<section>
				<button id="equalto" value="=" onclick="equalClicked()">=</button> 	
			</section>
		</div>
	</body>
</html>
              
            
!

CSS

              
                * {
	box-sizing: border-box;
}
/*This styles the BODY of the CALCUMAX*/
.calc {
	width: 500px;
	height: 600px;
	background-color: cadetblue;
	margin: 50px auto;
	border-radius: 50px;
	padding: 7px;
	text-align: center;
}

/*This styles the DISPLAY SCREEN*/
.calc > #screen {
	background-color: white;
	width: 70%;
	height: 70px;
	margin: 20px auto;
	border-radius: 50px 15px;
	font-size: 18pt;
	text-align: right;
	word-wrap: break-word;
	padding-right: 10px;
}


/*This styles the CLEAR button*/
.calc > button {
	width: 100px;
	background-color: lightgreen;
	padding: 7px;
	margin-left:20px;
	cursor: pointer;
	border-radius: 5px;
	box-shadow: 0px 5px 10px 0px green, 0 6px 20px 0 rgba(0,0,0,0.19);
}
.calc > button:hover {
	background-color: orange;
	outline-color: black;
	width: 150px;
	color: white;
}

/*This styles the OPERANDS / OPERATORS row*/
.calc > #operands {
	display: block;
	padding: 30px 10px;
	width: 80px;
	height: auto;
	float: left;
}
.calc > #operands .opera {
	padding: 7px;
	margin-top:  15px;
	width: 75px;
	height: 50px;
	max-height: 50px;
	background-color: aqua;
	cursor: pointer;
	border-radius: 10px;
	
}
.calc > #operands .opera:hover {
	background-color: orangered;
	outline-color: black;
	width: 85px;
	color: white;
	border-radius: 20px 10px;
}

/*This styles the FIGURES div*/
.calc > #numbers {
	padding-top: 20px;
	width: 350px;
	float: right;
}
.calc > #numbers .figures {
	padding: 10px;
	margin-top:  15px;
	width: 75px;
	height: 40px;
	background-color: khaki;
	cursor: pointer;
	border-radius: 10px;
	margin: 10px;
	
}
.calc > #numbers span button {
	height: 70px;
	width: 50px;
  	background-color: darkkhaki;
	border-radius: 20px;
	cursor: pointer;
}
.calc > #numbers .figures:hover {
	width: 100px;
	background-color: aqua;
	border-radius: 20px 5px;
}
.calc > #numbers span button:hover { 
	background-color: gainsboro;
	border-radius: 20px;
	box-shadow: 0px 2px 12px 0px green;
}

/*
This styles the EQUAL TO section*/
.calc > section button {
	background-color: rosybrown;
	width: 200px;
	padding: 7px;
	border-radius: 10px;
	cursor: pointer;
}
.calc > section {
	clear: both;
	width: 100%;
}
.calc > section button:hover {
	width: 250px;
	border-radius: 20px 5px;
	background-color: firebrick;
}
@media screen and (max-width: 520px) and (min-width: 320px) { 
	.calc {
		width: 100%;
		padding: 5px;
	}
	.calc > #operands {
	display: block;
	padding: 30px 10px;
	width: 80px;
	height: auto;
	float: left;
}
	.calc > #operands .opera {
	padding: 7px;
	margin-top:  5px;
	width: 45px;
	height: 50px;
	max-height: 50px;
	background-color: aqua;
	cursor: pointer;
	border-radius: 10px;
	}
	.calc > #numbers .figures {
	padding: 7px;
	margin-top:  10px;
	width: 50px;
	height: 40px;
	background-color: khaki;
	cursor: pointer;
	border-radius: 10px;
	margin: 10px;
	}
	.calc > #numbers {
	padding-top: 20px;
	width: 250px;
	float: right;
	}
	.calc > #operands .opera:hover, .calc > #numbers .figures:hover {
		width: 50px;
	}
	.calc > button:hover {
		width: 100px;
	}

}
              
            
!

JS

              
                let display = document.getElementById('screen');
function isclicked(value) {
        if(display.innerText === 0) {
            display.innerText = value;
        } else {
            display.innerText += value;
        }
        return display.innerText;
}
let equals = document.getElementById('equalto');
const equalClicked = () =>{
    if(display.innerText !== "") {
        display.innerText = eval(display.innerText)
    } else {
        display.innerText = "";
    }
}
const clearClicked =() => {
    display.innerText = "";
}
              
            
!
999px

Console