Skip to content

Instantly share code, notes, and snippets.

Avatar

Wanuja Ranasinghe Wanuja97

View GitHub Profile
@Wanuja97
Wanuja97 / script.js
Created Feb 23, 2021
BMI Calculator - JavaScript Part
View script.js
function Calculate(){
var height = document.getElementById("h-input").value;
var weight = document.getElementById("w-input").value;
var result = parseFloat(weight) /(parseFloat(height)/100)**2;
if(!isNaN(result)){
document.getElementById("bmi-output").innerHTML = result;
if(result < 18.5){
document.getElementById("bmi-status").innerHTML = "Underweight";
@Wanuja97
Wanuja97 / main.css
Created Feb 23, 2021
BMI Calculator CSS Part
View main.css
*{margin: 0; padding: 0;font-family: 'Old Standard TT', serif;}
.container{
display: grid;
justify-content: center;
align-content: center;
min-height: 100vh;
grid-template-columns: 30vw;
grid-template-rows: repeat(3,10vh) 5vh repeat(2,10vh);
grid-gap: 10px;
@Wanuja97
Wanuja97 / index.html
Last active Feb 23, 2021
BMI Calculator - HTML Part
View 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>Document</title>
<link rel="stylesheet" href="main.css">
<script src="script.js" defer></script>
<link rel="preconnect" href="https://fonts.gstatic.com">