Calculator | UI Design | Free Projects1 ☆ In this project, we can solve basic arithmetic calculations e.g. addition, subtraction, multiplication, and division .
☆ It is a calculator UI design. and source code freely available on our website FreeProjects1 and our official GitHub page .
Live View
Download
☆ It is free to open source projects, and source code is freely available on our GitHub page.
How to use ☆ For addition, press the first number then the plus operator(+), and then the second number, and then press the equal button to get the output.
☆ For subtraction, press the first number then the subtract or minus operator(-), and then the second number, and then press the equal button to get the output.
☆ For Multiplication, press the first number then the multiply operator(*), and then the second number, and then press the equal button to get the output .
☆ For division, press the first number then the division operator(/), and then the second number, and then press the equal button to get output .
☆ This project is responsive means it successfully works in mobile and desktop both versions.
☆ Used languages are HTML , CSS, and JavaScript.
Project Source Code: 1. index.html
<! DOCTYPE html >
< html lang ="en" >
< head >
< meta charset ="UTF-8" >
< meta http-equiv ="X-UA-Compatible" content ="IE=edge" >
< meta name ="viewport" content ="width=device-width, initial-scale=1.0" >
< title > Calculator | UI Design | Free Projects1 </ title >
< meta name ="keywords" content ="Bholu Singh, bholu singh github, FreeProjects1.blogspot.com" >
< meta name ="description" content ="In this project, we can solve the basic arithmetic calculations e.g. addition, subtraction, multiplication, and division.." >
< link rel ="shortcut icon" href ="favicon.png" type ="image/x-icon" >
< link rel ="stylesheet" type ="text/css" href ="style.css" >
</ head >
< body >
< div class ="container" >
< form class ="calculator" name ="calc" >
< input type ="text" id ="value" class ="value" name ="txt" readonly />
< span class ="num clear" onclick =" calc .txt .value = '' " > AC</ span >
< span class ="num" onclick =" document .calc .txt .value += '/' " > /</ span >
< span class ="num" onclick =" document .calc .txt .value += '*' " > *</ span >
< span class ="num" onclick =" document .calc .txt .value += '7' " > 7</ span >
< span class ="num" onclick =" document .calc .txt .value += '8' " > 8</ span >
< span class ="num" onclick =" document .calc .txt .value += '9' " > 9</ span >
< span class ="num" onclick =" document .calc .txt .value += '-' " > -</ span >
< span class ="num" onclick =" document .calc .txt .value += '4' " > 4</ span >
< span class ="num" onclick =" document .calc .txt .value += '5' " > 5</ span >
< span class ="num" onclick =" document .calc .txt .value += '6' " > 6</ span >
< span class ="num plus" onclick =" document .calc .txt .value += '+' " > +</ span >
< span class ="num" onclick =" document .calc .txt .value += '1' " > 1</ span >
< span class ="num" onclick =" document .calc .txt .value += '2' " > 2</ span >
< span class ="num" onclick =" document .calc .txt .value += '3' " > 3</ span >
< span class ="num" onclick =" document .calc .txt .value += '0' " > 0</ span >
< span class ="num" onclick =" document .calc .txt .value += '.' " > .</ span >
< span class ="num" onclick =" del (); " > Del</ span >
< span class ="num equal" onclick =" document .calc .txt .value = eval ( calc .txt .value ) " > =</ span >
</ form >
</ div >
< script type ="text/javascript" >
function del ()
{
var prevalue = calc .txt .value ;
calc .txt .value = prevalue .substr (0 ,prevalue .length -1 );
}
</ script >
</ body >
</ html >
2. style.css @import url ('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;&display=swap' );
* {
margin : 0 ;
padding : 0 ;
box-sizing : border-box ;
}
body {
display : flex ;
justify-content : center ;
align-items : center ;
min-height : 100vh ;
}
.container {
position : relative ;
background : rgba (255 , 255 , 255 , 0.05 );
border-radius : 6px ;
overflow : hidden ;
z-index : 10 ;
backdrop-filter : blur (15px );
border-top : 1px solid rgba (255 , 255 , 255 , 0.2 );
border-left : 1px solid rgba (255 , 255 , 255 , 0.2 );
box-shadow : 5px 5px 30px rgba (0 , 0 , 0 , 0.2 );
}
form {
margin : 5px ;
}
.container .calculator {
position : relative ;
display : grid ;
}
.container .calculator .value {
grid-column : span 4 ;
width : 311px ;
height : 120px ;
text-align : right ;
border : none ;
outline : none ;
padding : 10px ;
font-size : 30px ;
margin-bottom : 5px ;
background : transparent ;
box-shadow : inset 0 0 18px rgba (0 , 0 , 0 , 0.1 );
}
.container .calculator span {
display : grid ;
place-items : center ;
width : 72px ;
height : 72px ;
font-weight : 400 ;
cursor : pointer ;
font-size : 20px ;
user-select : none ;
margin : 3px ;
border-radius : 20% ;
box-shadow : 0 0 10px rgba (0 , 0 , 0 , 0.1 );
transition : 0.5s ;
}
.container .calculator span:hover {
transition : 0s ;
box-shadow : 0 0 10px rgba (0 , 0 , 0 , 0.2 );
background : rgba (0 , 0 , 0 , 0.05 );
}
.container .calculator span:active {
background : lightgreen ;
color : #192f00 ;
font-size : 24px ;
font-weight : 500 ;
}
.container .calculator .clear {
grid-column : span 2 ;
width : 150px ;
background : rgba (255 , 255 , 255 , 0.05 );
}
.container .calculator .plus {
grid-row : span 2 ;
height : 150px ;
}
.equal {
background : rgba (255 , 255 , 255 , 0.05 );
}
Learn Java Programming ☆ if you want to learn java programming freely, visit our official link...
Start Learning
Please do not enter any spam link in the comment box.