Skip to content

Commit

Permalink
BMI-calculator (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhairyagothi authored Jan 10, 2025
2 parents 834d820 + 955a17c commit 9333c9d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 30 deletions.
28 changes: 16 additions & 12 deletions public/BMI_Calculator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@
</head>
<body>
<div class="bmi">
<h2>Body Mass Index Calculator</h2>
<p class="text">Height</p>
<select id="height-unit">
<option value="cm">cm</option>
<option value="feet">feet/inches</option>
<h2 style="color: azure;font-weight: bold;font-size:40px">Body Mass Index Calculator</h2>
<p class="text" style="font-weight: bold;font-size:20px">Height</p>
<select id="height-unit" style="text-align: center;">
<option value="cm" >Centimeter</option>
<option value="feet">Feet/Inches</option>
</select>
<input type="text" id="height">
<p class="text">Weight</p>
<select id="weight-unit">
<option value="kg">kg</option>
<option value="lb">pounds</option>
<input type="text" id="height" title="Enter your height" placeholder="Height">
<br>
<br>

<p class="text" style="font-weight: bold;font-size:20px">Weight</p>
<select id="weight-unit" style="text-align: center;">
<option value="kg">Kilogram</option>
<option value="lb">Pounds</option>
</select>
<input type="text" id="weight">
<input type="text" id="weight" title="Enter your weight" placeholder="Weight">
<p id="result"></p><button id="btn">Calculate</button>
<br>
<div id="result"></div>
<div id="category"></div>
<div id="tips"></div>
Expand Down Expand Up @@ -59,7 +63,7 @@ <h2>Body Mass Index Calculator</h2>
</tr>
</tbody>
</table>
<canvas id="bmiChart"></canvas>
<canvas id="bmiChart" style="background-color: black;"></canvas>
</div>
<script src="script.js"></script>
<footer class="footer">
Expand Down
11 changes: 7 additions & 4 deletions public/BMI_Calculator/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,20 @@ var bmiChart = new Chart(ctx, {
labels: [],
datasets: [{
label: 'BMI Over Time',

data: [],
borderColor: 'rgba(75, 192, 192, 1)',
borderColor: 'rgb(254, 250, 250)',
borderWidth: 1,
fill: false
fill: true,
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
beginAtZero: true,
},


}
}
});
Expand Down
35 changes: 21 additions & 14 deletions public/BMI_Calculator/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ body {
padding: 0;
text-align: center;
font-family: "Montserrat";
background: rgb(34, 193, 195);
/* background: rgb(34, 193, 195); */
background: linear-gradient(
0deg,
rgba(34, 193, 195, 1) 0%,
rgba(253, 68, 45, 1) 100%
#cc5333 0%,
#23074d 100%

);
min-height: 100vh;
}
.bmi {
color: white;
width: 350px;
position: absolute;
top: 50%;
left: 50%;
background-color: #fff;
background-color: black;
transform: translate(-50%, -50%);
padding: 20px;
border-radius: 10px;
Expand All @@ -32,13 +34,13 @@ h2 {
}
#weight-unit,
#height-unit {
color: #222f3e;
color: black;
text-align: left;
font-size: 20px;
font-weight: 200;
outline: none;
border: 1px solid black;
border-radius: 7px;
border-radius: 10px;
width: 200px;
height: 35px;
height: 35px;
Expand All @@ -50,18 +52,18 @@ h2 {
transition: 0.5s;
}
#result {
color: #341f97;
color: white;
}
#btn {
font-family: inherit;
margin-top: 10px;
border: none;
border: blue;
color: #000;
background: lightblue;
background: gainsboro;
width: 150px;
padding: 10px;
border-radius: 30px;
outline: none;
border-radius: 30px ;
outline: white;
cursor: pointer;
transition: 0.5s;
}
Expand All @@ -79,12 +81,13 @@ table {
}

tr {
background: lightblue;
background: rgb(68, 38, 105);
color: white;
}

th {
background: #fff;
color: #000;
background: #0d0101;
color: #fffbfb;
font-weight: bold;
}

Expand All @@ -102,9 +105,13 @@ th {
height: 759px;
width: 1519px;
margin-bottom: 80px;

}

#height, #weight {
height: 35px;
margin-top: 10px;
}
.footer_social{
color: white;
}

0 comments on commit 9333c9d

Please sign in to comment.