A Pen by Terron Johnson on CodePen.
Created
October 16, 2017 17:35
-
-
Save Terron23/5e39f79fadff02ac6d2576e7db65196b to your computer and use it in GitHub Desktop.
Calculator Pt 11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<center> | |
<h1>The Calculator</h1> | |
<div id="calc" class="container text-center"> | |
<center> | |
<form name="calculator"> | |
<input type="text" name="answer" placeholder="0"> | |
<br> | |
<input type="button" value=" 1 " onclick="calculator.answer.value += '1'"> | |
<input type="button" value=" 2 " onclick="calculator.answer.value += '2'"> | |
<input type="button" value=" 3 " onclick="calculator.answer.value += '3'"> | |
<input type="button" value=" + " onclick="calculator.answer.value += '+'"> | |
<br> | |
<input type="button" value=" 4 " onclick="calculator.answer.value += '4'"> | |
<input type="button" value=" 5 " onclick="calculator.answer.value += '5'"> | |
<input type="button" value=" 6 " onclick="calculator.answer.value += '6'"> | |
<input type="button" value=" - " onclick="calculator.answer.value += '-'"> | |
<br> | |
<input type="button" value=" 7 " onclick="calculator.answer.value += '7'"> | |
<input type="button" value=" 8 " onclick="calculator.answer.value += '8'"> | |
<input type="button" value=" 9 " onclick="calculator.answer.value += '9'"> | |
<input type="button" value=" * " onclick="calculator.answer.value += '*'"> | |
<br> | |
<input type="button" value=" c " onclick="calculator.answer.value = ''"> | |
<input type="button" value=" 0 " onclick="calculator.answer.value += '0'"> | |
<input type="button" value=" = " onclick="calculator.answer.value = eval(calculator.answer.value)"> | |
<input type="button" value=" / " onclick="calculator.answer.value += '/'"> | |
</center> | |
</form> | |
</center> | |
</div> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background-color: gray; | |
margin-top: 30px; | |
padding: 20px; | |
} | |
.container { | |
width: 400px; | |
border: 2px solid black; | |
border-radius: 8px; | |
padding: 20px; | |
background: gold; | |
} | |
input[type=button] { | |
background: purple; | |
width: 20%; | |
font-size: 20px; | |
font-weight: bold; | |
border-radius: 4px; | |
margin: 2px; | |
padding: 15px; | |
} | |
input[type=text] { | |
display: block; | |
margin: 0 auto; | |
width: 90%; | |
font-size: 20px; | |
font-weight: bold; | |
border-radius: 4px; | |
padding: 20px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment