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

Added BMI_CALCULATOR_JS #566

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,14 @@ <h3 class="card__heading">Temperature Converter</h3>
<h3 class="card__heading">Astromania</h3>
</div>
</a>
<a class="card" href="projects/BMI_Calculator_JS/index.html">
<div class="card__background" style="background-image: url(projects/BMI_Calculator_JS/Image/bmi\ image.png)"></div>
<div class="card__content">
<p class="card__category">Calculator</p>
<h3 class="card__heading">BMI Calculator JS</h3>

</div>
</a>
<a class="card" href="projects/Netflix-Replica/index.html">
<div class="card__background" style="background-image: url(projects/Netflix-Replica/image/mobile.jpg); background-size: cover;"></div>
<div class="card__content">
Expand Down
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.
20 changes: 20 additions & 0 deletions projects/BMI_Calculator_JS/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!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;
}
66 changes: 66 additions & 0 deletions projects/BMI_Calculator_JS/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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;

}