Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As i have created the BMI_Calculator using js and solved the issue-#514 #555

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added projects/BMI_Calculator_JS/Image/bmi image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions projects/BMI_Calculator_JS/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>BMI CALCULATOR</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div>
<h2>BMI CALCULATOR</h2>
<p class="text">Height</p>
<input type="text" id="h" >
<p class="text">Weight</p>
<input type="text" id="w">
<p id="result"></p>
<button id="btn" onclick="bmi()">Calculate</button>
<p id="info">Please enter height[cm] and weight [kg]</p>
</div>
<script type="text/javascript" src="script.js"></script>

</body>
</html>
7 changes: 7 additions & 0 deletions projects/BMI_Calculator_JS/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function bmi(){
let h=document.getElementById("h").value;
let w=document.getElementById("w").value;
let ans=w/(h/100*h/100);
let bmio=(ans.toFixed(2));
document.getElementById("result").innerHTML="Your BMI is "+bmio;
}
67 changes: 67 additions & 0 deletions projects/BMI_Calculator_JS/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
body{
margin: 0;
padding: 0;
text-align: center;
background-image: linear-gradient(120deg,#ff6b6b,#5f27cd);
min-height: 100vh;

}
div{
width: 500px;
position: absolute;
top: 50%;
left: 50%;
background-color: #fff;
transform: translate(-50%,-50%);
padding: 20px;
border-radius: 10px;
box-shadow: 1px 1px 20px #ee5253;

}
h2{
font-size: 30px;
font-weight: 600;
}
.text{
text-align: left;
margin-left: 150px;
}
#w,#h{
color:#222f3e;
text-align: left;
font-size: 20px;
font-weight: 200;
outline: none;
border:none;
background: none;
border-bottom: 1px solid #341f97;
width: 200px;
}
#w:focus,#h:focus{
border-bottom: 2px solid #841f97;
width: 300px;
transition: .5s;
}

#result{
color:#341f97;
}
#btn{
margin-top: 10px;
border:none;
color: #fff;
background-image: linear-gradient(120deg,#ff6b6b,#5f27cd);
width: 150px;
padding: 10px;
border-radius: 30px;
outline: none;
cursor: pointer;
}
#btn:hover{
box-shadow: 1px 1px 10px #341f97;

}
#info{
font-size: 12px;

}