-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
137 lines (125 loc) · 2.87 KB
/
index.html
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
<html>
<head>
<title>Temperature Degree converter</title>
<link rel="icon" href="tfavi.ico">
</head>
<style>
* {
margin: 0;
padding: 0;
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
.bimage{
background-image: linear-gradient(rgba(0,0,0,0.5),rgba(0, 0, 0, 0.5)),url("https://wallpapercave.com/wp/wp6946084.jpg");
/background-image: url();/
background-repeat: no-repeat;
background-size: cover;
height:100vh;
color: black;
display: flex;
justify-content: center;
align-items: center;
font-style:italic;
font-size:40px;
font-family: "Roboto";
font-weight: bold;
}
.ground {
width: 100%;
height: 100vh;
background-color:
linear-gradient(rgb(140, 219, 140), rgb(20, 141, 20));
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.ground h1 {
color: black;
font-weight: 800;
font-size: 30px;
text-align: center;
}
.converter-row {
display: flex;
width: 30%;
justify-content: space-between;
align-items: center;
border-radius: 10px;
padding: 50px 20px;
}
.converter-roww {
display: flex;
width: 30%;
justify-content: space-between;
align-items: center;
border-radius: 10px;
padding: 50px 20px;
}
.col {
flex-basis: 32%;
text-align: center;
}
.col label {
font-size: 20px;
font-weight: 500;
margin-bottom: 10px;
color:crimson;
font-weight: bold;
}
.col input {
width: 150px;
height: 30px;
background: #CAE7DF;
border-radius: 5px;
text-align: center;
}
</style>
<body>
<div class="bimage">
<div class="ground">
<bold>Temperature Degree converter</bold></h1>
<div class="converter-row">
<div class="col">
<label>Fahrenheit</label>
<input type="number" id="fahrenheit">
</div>
<div class="col">
<label>Celsius</label>
<input type="number" id="celsius"></br>
</div>
<div class="col">
<label>Kelvin</label>
<input type="number" id="kelvin">
</div>
</div>
</div>
</div>
<script>
let celsius = document.getElementById('celsius');
let fahrenheit = document.getElementById('fahrenheit');
let kelvin = document.getElementById('kelvin');
celsius.oninput = function () {
let f = (parseFloat(celsius.value) * 9) / 5 + 32;
fahrenheit.value = parseFloat(f.toFixed(2));
let k = (parseFloat(celsius.value) + 273.15);
kelvin.value = parseFloat(k.toFixed(2));
}
fahrenheit.oninput = function () {
let c = ((parseFloat(
fahrenheit.value) - 32) * 5) / 9;
celsius.value = parseFloat(c.toFixed(2));
let k = (parseFloat(
fahrenheit.value) - 32) * 5 / 9 + 273.15;
kelvin.value = parseFloat(k.toFixed(2));
}
kelvin.oninput = function () {
let f = (parseFloat(
kelvin.value) - 273.15) * 9 / 5 + 32;
fahrenheit.value = parseFloat(f.toFixed(2));
let c = (parseFloat(kelvin.value) - 273.15);
celsius.value = parseFloat(c.toFixed(2));
}
</script>
</body>
</html>