File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments