-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
201 lines (174 loc) · 5.06 KB
/
index.html
File metadata and controls
201 lines (174 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BMI Calculator</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary-color: #3498db;
--secondary-color: #2ecc71;
--background-color: #f4f6f7;
--text-color: #2c3e50;
--white: #ffffff;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 16px;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: var(--background-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
line-height: 1.6;
color: var(--text-color);
padding: 1rem;
}
.container {
background-color: var(--white);
width: 100%;
max-width: 500px;
padding: 2.5rem;
border-radius: 15px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
text-align: center;
transition: all 0.3s ease;
}
.container:hover {
transform: scale(1.02);
}
h1 {
color: var(--primary-color);
margin-bottom: 1.5rem;
font-size: 2rem;
display: flex;
align-items: center;
justify-content: center;
}
h1 i {
margin-right: 10px;
color: var(--secondary-color);
}
.input-group {
margin-bottom: 1.5rem;
position: relative;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
color: var(--text-color);
text-align: left;
}
input {
width: 100%;
padding: 0.75rem 1rem;
border: 2px solid #e0e0e0;
border-radius: 8px;
font-size: 1rem;
transition: all 0.3s ease;
}
input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}
#calculateBtn {
width: 100%;
padding: 0.75rem;
background-color: var(--primary-color);
color: white;
border: none;
border-radius: 8px;
font-size: 1rem;
cursor: pointer;
transition: all 0.3s ease;
text-transform: uppercase;
letter-spacing: 1px;
}
#calculateBtn:hover {
background-color: #2980b9;
}
#calculateBtn:active {
transform: scale(0.98);
}
#result {
margin-top: 1.5rem;
font-size: 1.2rem;
font-weight: 600;
color: var(--secondary-color);
padding: 1rem;
background-color: #f1f8ff;
border-radius: 8px;
word-wrap: break-word;
}
/* Responsive Adjustments */
@media screen and (max-width: 600px) {
html {
font-size: 14px;
}
.container {
width: 100%;
max-width: 100%;
padding: 1.5rem;
margin: 0 auto;
}
h1 {
font-size: 1.75rem;
}
input,
#calculateBtn {
font-size: 0.9rem;
padding: 0.65rem 0.9rem;
}
}
@media screen and (max-height: 700px) {
.container {
padding: 1.5rem;
}
}
/* Accessibility and Touch Improvements */
@media (hover: none) and (pointer: coarse) {
input,
#calculateBtn {
min-height: 44px;
min-width: 44px;
}
}
/* Print Styles */
@media print {
body {
background-color: white;
}
.container {
box-shadow: none;
border: 1px solid #ccc;
}
}
</style>
</head>
<body>
<div class="container">
<h1><i class="fas fa-weight-scale"></i>BMI Calculator</h1>
<div class="input-group">
<label for="weight">Weight (kg)</label>
<input type="number" id="weight" step="0.1" min="0" required placeholder="Enter your weight" pattern="\d*">
</div>
<div class="input-group">
<label for="height">Height (cm)</label>
<input type="number" id="height" step="0.1" min="0" required placeholder="Enter your height" pattern="\d*">
</div>
<button id="calculateBtn">Calculate BMI</button>
<div id="result"></div>
</div>
<script src="bmi.js"></script>
</body>
</html>