Skip to content

Commit 32e8020

Browse files
authored
Merge pull request #162 from siddhi-244/siddhi
ADDED BMI CALCULATOR
2 parents b2fc1cc + 550d88c commit 32e8020

File tree

5 files changed

+130
-0
lines changed

5 files changed

+130
-0
lines changed

Index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@
5252
| [Image Filter App]() |An Awesome Image Filter App written in Html,Css,Javascript and CamanJS.|
5353
| [Form Validation](https://github.com/Ayushparikh-code/Web-dev-mini-projects/tree/main/form-validation) |A basic sign up page with all the validations in javascript. |
5454
| [Age Calculator](https://github.com/Ayushparikh-code/Web-dev-mini-projects/tree/main/age-calculator) | A website which can be used to calculate age of a person in days,months and years . |
55+
| [BMI Calculator](https://github.com/Ayushparikh-code/Web-dev-mini-projects/tree/main/bmi-calculator) | A basic website which can be used to calculate body mass index |

bmi-calculator/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
### BMI Calculator
2+
BMI calculator can be used to calculate body mass index of people.
3+
4+
### Use of the Project:
5+
It can be used in gyms etc to check if a person is overweight or underweight.
6+
7+
### Used Technologies
8+
* HTML5
9+
* CSS3
10+
* JavaScript
11+
12+
13+
#### Steps to Use:
14+
15+
---
16+
17+
- Download or clone the repository
18+
19+
```
20+
git clone https://github.com/Ayushparikh-code/Web-dev-mini-projects.git
21+
```
22+
23+
- Go to the directory
24+
- Run the index.html file
25+
- Start Calculating!!
26+
---
27+
28+
## Screenshots
29+
![Screenshot (35)](https://user-images.githubusercontent.com/69195262/125057793-3d825f00-e0c7-11eb-8a87-a80ecf6603e1.png)
30+
31+

bmi-calculator/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>BMI CALCULATOR</title>
5+
<link rel="stylesheet" type="text/css" href="style.css">
6+
</head>
7+
<body>
8+
<div>
9+
<h2>BMI CALCULATOR</h2>
10+
<p class="text">Height</p>
11+
<input type="text" id="h" >
12+
<p class="text">Weight</p>
13+
<input type="text" id="w">
14+
<p id="result"></p>
15+
<button id="btn" onclick="bmi()">Calculate</button>
16+
<p id="info">Please enter height[cm] and weight [kg]</p>
17+
</div>
18+
<script type="text/javascript" src="script.js"></script>
19+
20+
</body>
21+
</html>
22+

bmi-calculator/script.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function bmi(){
2+
let h=document.getElementById("h").value;
3+
let w=document.getElementById("w").value;
4+
let ans=w/(h/100*h/100);
5+
let bmio=(ans.toFixed(2));
6+
document.getElementById("result").innerHTML="Your BMI is "+bmio;
7+
}
8+

bmi-calculator/style.css

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
body{
2+
margin: 0;
3+
padding: 0;
4+
text-align: center;
5+
background-image: linear-gradient(120deg,#ff6b6b,#5f27cd);
6+
min-height: 100vh;
7+
8+
}
9+
div{
10+
width: 500px;
11+
position: absolute;
12+
top: 50%;
13+
left: 50%;
14+
background-color: #fff;
15+
transform: translate(-50%,-50%);
16+
padding: 20px;
17+
border-radius: 10px;
18+
box-shadow: 1px 1px 20px #ee5253;
19+
20+
}
21+
h2{
22+
font-size: 30px;
23+
font-weight: 600;
24+
}
25+
.text{
26+
text-align: left;
27+
margin-left: 150px;
28+
}
29+
#w,#h{
30+
color:#222f3e;
31+
text-align: left;
32+
font-size: 20px;
33+
font-weight: 200;
34+
outline: none;
35+
border:none;
36+
background: none;
37+
border-bottom: 1px solid #341f97;
38+
width: 200px;
39+
}
40+
#w:focus,#h:focus{
41+
border-bottom: 2px solid #841f97;
42+
width: 300px;
43+
transition: .5s;
44+
}
45+
46+
#result{
47+
color:#341f97;
48+
}
49+
#btn{
50+
margin-top: 10px;
51+
border:none;
52+
color: #fff;
53+
background-image: linear-gradient(120deg,#ff6b6b,#5f27cd);
54+
width: 150px;
55+
padding: 10px;
56+
border-radius: 30px;
57+
outline: none;
58+
cursor: pointer;
59+
}
60+
#btn:hover{
61+
box-shadow: 1px 1px 10px #341f97;
62+
63+
}
64+
#info{
65+
font-size: 12px;
66+
67+
}
68+

0 commit comments

Comments
 (0)