modern calculator

Currently reading:
 modern calculator

WNQ_16

Member
LV
0
Joined
Sep 8, 2023
Threads
2
Likes
0
Credits
190©
Cash
0$
CSS:
                                                            * {
                                                                margin: 0;
                                                                padding: 0;
                                                                box-sizing: border-box;
                                                                font-family: "Courier New", Courier, monospace;
                                                            }
                                                            
                                                            body {
                                                                display: flex;
                                                                height: 100vh;
                                                                align-items: center;
                                                                justify-content: center;
                                                                background-color: #202020;
                                                            }
                                                            
                                                            .container {
                                                                position: relative;
                                                                min-width: 300px;
                                                                min-height: 400px;
                                                                padding: 40px 30px 30px;
                                                                border-radius: 20px;
                                                                box-shadow: 25px 25px 75px rgba(0, 0, 0, 0.25), 10px 10px 70px rgba(255, 255, 255, 0.25), inset -5px -5px 15px rgba(0, 0, 0, 0.25), inset 5px 5px 15px rgba(0, 0, 0, 0.25);
                                                            }
                                                            
                                                            .container span {
                                                                color: #fff;
                                                                position: relative;
                                                                display: grid;
                                                                width: 80px;
                                                                place-items: center;
                                                                margin: 8px;
                                                                height: 80px;
                                                                background: linear-gradient(180deg, #2f2f2f, #3f3f3f);
                                                                box-shadow: inset -8px 0 8px rgba(0, 0, 0, 0.15), inset 0 -8px 8px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(0, 0, 0, 0.75), 10px 20px 25px rgba(0, 0, 0, 0.4);
                                                                user-select: none;
                                                                cursor: pointer;
                                                                font-weight: 400;
                                                                border-radius: 10px;
                                                            }
                                                            
                                                            .calculator span:active {
                                                                filter: brightness(1.5);
                                                            }
                                                            
                                                            .calculator span::before {
                                                                content: "";
                                                                position: absolute;
                                                                top: 3px;
                                                                left: 4px;
                                                                bottom: 14px;
                                                                right: 12px;
                                                                border-radius: 10px;
                                                                background: linear-gradient(90deg, #2d2d2d, #4d4d4d);
                                                                box-shadow: -5px -5px 15px rgba(0, 0, 0, 0.1), 10px 5px 10px rgba(0, 0, 0, 0.15);
                                                                border-left: 1px solid rgba(15, 14, 16, 0.267);
                                                                border-bottom: 1px solid rgba(230, 230, 230, 0.267);
                                                                border-top: 1px solid rgba(0, 0, 0, 0.6);
                                                            }
                                                            
                                                            .calculator span i {
                                                                position: relative;
                                                                font-style: normal;
                                                                font-size: 1.5em;
                                                                text-transform: uppercase;
                                                            }
                                                            
                                                            .calculator {
                                                                position: relative;
                                                                display: grid;
                                                            }
                                                            
                                                            .calculator .value {
                                                                position: relative;
                                                                grid-column: span 4;
                                                                height: 100px;
                                                                width: calc(100% - 20px);
                                                                left: 10px;
                                                                border: none;
                                                                outline: none;
                                                                background-color: #9fa679;
                                                                margin-bottom: 10px;
                                                                border-radius: 10px;
                                                                box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.75);
                                                                text-align: right;
                                                                padding: 10px;
                                                                font-size: 2em;
                                                            }
                                                            
                                                            .calculator .clear {
                                                                grid-column: span 2;
                                                                width: 180px;
                                                                background: #f00;
                                                            }
                                                            
                                                            .calculator .clear::before {
                                                                background: linear-gradient(90deg, #d20000, #ffffff5c);
                                                                border-left: 1px solid #fff4;
                                                                border-bottom: 1px solid #fff4;
                                                                border-top: 1px solid #fff4;
                                                            }
                                                            
                                                            .calculator .plus {
                                                                grid-row: span 2;
                                                                height: 180px;
                                                            }
                                                            
                                                            .calculator .equal {
                                                                background: #2196f3;
                                                            }
                                                            
                                                            .calculator .equal::before {
                                                                background: linear-gradient(90deg, #1479c9, #ffffff5c);
                                                                border-left: 1px solid #fff4;
                                                                border-bottom: 1px solid #fff4;
                                                                border-top: 1px solid #fff4;
                                                            }
                                                            
                                                            .calculator .minus {
                                                                background: #2196f3
                                                            }
                                                            
                                                            .calculator .minus::before {
                                                                background: linear-gradient(90deg, #1479c9, #ffffff5c);
                                                                border-left: 1px solid #fff4;
                                                                border-bottom: 1px solid #fff4;
                                                                border-top: 1px solid #fff4;
                                                            }
                                                            
                                                            .calculator .times {
                                                                background: #2196f3
                                                            }
                                                            
                                                            .calculator .times::before {
                                                                background: linear-gradient(90deg, #1479c9, #ffffff5c);
                                                                border-left: 1px solid #fff4;
                                                                border-bottom: 1px solid #fff4;
                                                                border-top: 1px solid #fff4;
                                                            }
                                                            
                                                            .calculator .plus {
                                                                background: #2196f3
                                                            }
                                                            
                                                            .calculator .plus::before {
                                                                background: linear-gradient(90deg, #1479c9, #ffffff5c);
                                                                border-left: 1px solid #fff4;
                                                                border-bottom: 1px solid #fff4;
                                                                border-top: 1px solid #fff4;
                                                            }
                                                            
                                                            .calculator .divide {
                                                                background: #f00
                                                            }
                                                            
                                                            .calculator .divide::before {
                                                                background: linear-gradient(90deg, #d20000, #ffffff5c);
                                                                border-left: 1px solid #fff4;
                                                                border-bottom: 1px solid #fff4;
                                                                border-top: 1px solid #fff4;
                                                            }
                                                            
                                                            .alnaji {
                                                                color: #ffffff;
                                                                height: 97%;
                                                                position: absolute;
                                                                font-weight: bold;
                                                                font: lighter;
                                                            }
HTML:
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="discription" content=" best calcaulator no mistake">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>calculator</title>
    <link rel="stylesheet" href="styel.css">
</head>

<body>
    <p class="alnaji">BY Faisal Al-Naji</p>
    <div class="container">
        <form action="" name="calc" class="calculator">
            <input type="text" class="value" readonly name="txt" />
            <span class="num clear" onclick="calc.txt.value=''"><i>C</i></span>
            <span class="num divide" onclick="calc.txt.value+='/'"><i>&divide;</i></span>
            <span class="num times" onclick="calc.txt.value+='*'"><i>&times;</i></span>
            <span class="num" onclick="calc.txt.value+='7'"><i>7</i></span>
            <span class="num" onclick="calc.txt.value+='8'"><i>8</i></span>
            <span class="num" onclick="calc.txt.value+='9'"><i>9</i></span>
            <span class="num minus" onclick="calc.txt.value+='-'"><i>-</i></span>
            <span class="num" onclick="calc.txt.value+='4'"><i>4</i></span>
            <span class="num" onclick="calc.txt.value+='5'"><i>5</i></span>
            <span class="num" onclick="calc.txt.value+='6'"><i>6</i></span>
            <span class="num plus" onclick="calc.txt.value+='+'"><i>+</i></span>
            <span class="num" onclick="calc.txt.value+='1'"><i>1</i></span>
            <span class="num" onclick="calc.txt.value+='2'"><i>2</i></span>
            <span class="num" onclick="calc.txt.value+='3'"><i>3</i></span>
            <span class="num" onclick="calc.txt.value+='0'"><i>0</i></span>
            <span class="num" onclick="calc.txt.value+='00'"><i>00</i></span>
            <span class="num" onclick="calc.txt.value+='.'"><i>.</i></span>

            <span class="num equal" onclick="document.calc.txt.value=eval(calc.txt.value)"><i>=</i></span
              
      >
    </form>
  </div>
  </div>
  </div>
 
</body>

</html>
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Tips
Top Bottom