A Pen by Diego Loiola on CodePen.
Created
April 6, 2021 19:03
-
-
Save diegoamloiola/9fc671033411ff725f3f7e979bf9760c to your computer and use it in GitHub Desktop.
Calculadora
This file contains hidden or 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
| <html> | |
| <head> | |
| <title> | |
| Imersão Dev - Aula 02 | |
| </title> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h1 class="page-title"> | |
| Calculadora | |
| </h1> | |
| <img src="https://www.alura.com.br/assets/img/imersoes/dev-2021/logo-imersao-calculadora.svg" class="page-logo" | |
| alt=""> | |
| <div class="calculadora"> | |
| </div> | |
| </div> | |
| <a href="https://alura.com.br/" target="_blank"> | |
| <img src="https://www.alura.com.br/assets/img/home/alura-logo.svg" alt="" class="alura-logo"> | |
| </a> | |
| <h2></h2> | |
| </body> | |
| </html> |
This file contains hidden or 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
| var primeiroValor = parseInt(prompt("Digite o primeiro número: ")) | |
| var segundoValor = parseInt(prompt("Digite o segundo número: ")) | |
| var resultado = 0 | |
| var operacao = prompt("Digite 1 para somar, 2 para subtração, 3 para multiplicação ou 4 para divisão") | |
| if(operacao==1){ | |
| resultado = primeiroValor + segundoValor | |
| document.write("<h2>"+primeiroValor+" + "+segundoValor+" = "+resultado+"</h2>") | |
| } else if(operacao==2){ | |
| resultado = primeiroValor - segundoValor | |
| document.write("<h2>"+primeiroValor+" - "+segundoValor+" = "+resultado+"</h2>") | |
| } else if(operacao==3){ | |
| resultado = primeiroValor * segundoValor | |
| document.write("<h2>"+primeiroValor+" * "+segundoValor+" = "+resultado+"</h2>") | |
| } else if(operacao==4){ | |
| resultado = primeiroValor / segundoValor | |
| document.write("<h2>"+primeiroValor+" / "+segundoValor+" = "+resultado+"</h2>") | |
| } else{ | |
| document.write("<h2>Opção Inválida</h2>") | |
| } | |
This file contains hidden or 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 { | |
| font-family: 'Roboto Mono',monospace; | |
| min-height: 854px; | |
| background-image: url('https://www.alura.com.br/assets/img/imersoes/dev-2021/dia-2-calculadora-certa.png'); | |
| background-color: #000000; | |
| background-size: cover; | |
| background-position: center top; | |
| background-repeat: no-repeat; | |
| } | |
| .container { | |
| text-align: center; | |
| padding: 20px; | |
| height: 100vh; | |
| } | |
| .page-title { | |
| color: #ffffff; | |
| margin: 0 0 5px; | |
| } | |
| .page-subtitle { | |
| color: #ffffff; | |
| margin-top: 5px; | |
| } | |
| .page-logo { | |
| width: 200px; | |
| } | |
| .calculadora { | |
| width: 264px; | |
| height:360px; | |
| background-image: url('https://www.alura.com.br/assets/img/imersoes/dev-2021/dia-2-calculadora-calc.png'); | |
| margin: 0 auto; | |
| position: relative; | |
| } | |
| h2 { | |
| position: absolute; | |
| font-size:16px; | |
| font-weight:bold; | |
| top: 142px; | |
| left: calc(50% - 72.5px); | |
| width: 145px; | |
| text-align:center; | |
| } | |
| .alura-logo { | |
| width: 40px; | |
| position: absolute; | |
| top: 10px; | |
| right:10px; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment