Skip to content

Commit 924d7ed

Browse files
authored
Merge pull request #733 from Rugved-pro/improve-weather-widget
Enhance Weather Widget: Modern CSS-only Design and Responsive Layout
2 parents 8748879 + f64aa19 commit 924d7ed

File tree

2 files changed

+89
-45
lines changed

2 files changed

+89
-45
lines changed

Weather/index.html

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,43 @@ <h2>New York City</h2>
1717
</div>
1818
<div class="weather-details">
1919
<h3>25°C</h3>
20-
<p>Sunny</p>
21-
<p>Humidity: 55%</p>
22-
<p>Wind: 12 km/h</p>
20+
<p>☀️ Sunny</p>
21+
<p>💧 Humidity: 55%</p>
22+
<p>💨 Wind: 12 km/h</p>
2323
</div>
2424
</div>
2525

2626
<!-- Weekly forecast -->
2727
<div class="weekly-forecast">
2828
<h2>Weekly Forecast</h2>
2929
<div class="forecast-row">
30-
<div class="day-forecast">
30+
<div class="day-forecast sunny">
3131
<p>Mon</p>
3232
<h3>26°C</h3>
33-
<p>Sunny</p>
33+
<p>☀️ Sunny</p>
3434
</div>
35-
<div class="day-forecast">
35+
<div class="day-forecast cloudy">
3636
<p>Tue</p>
3737
<h3>22°C</h3>
38-
<p>Cloudy</p>
38+
<p>☁️ Cloudy</p>
3939
</div>
40-
<div class="day-forecast">
40+
<div class="day-forecast rainy">
4141
<p>Wed</p>
4242
<h3>19°C</h3>
43-
<p>Rainy</p>
43+
<p>🌧️ Rainy</p>
4444
</div>
45-
<div class="day-forecast">
45+
<div class="day-forecast partly">
4646
<p>Thu</p>
4747
<h3>24°C</h3>
48-
<p>Partly Cloudy</p>
48+
<p>Partly Cloudy</p>
4949
</div>
50-
<div class="day-forecast">
50+
<div class="day-forecast sunny">
5151
<p>Fri</p>
5252
<h3>28°C</h3>
53-
<p>Sunny</p>
53+
<p>☀️ Sunny</p>
5454
</div>
5555
</div>
5656
</div>
5757
</body>
5858

59-
</html>
59+
</html>

Weather/style.css

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,79 +7,123 @@
77

88
body {
99
display: flex;
10-
justify-content: center;
11-
align-items: center;
1210
flex-direction: column;
13-
background-color: #fff;
11+
align-items: center;
12+
background: linear-gradient(to bottom, #d1eef8, #e5f3f7);
1413
padding: 20px;
15-
height: 100vh;
14+
min-height: 100vh;
1615
}
1716

17+
/* Main weather widget */
1818
.weather-widget {
19-
background-color: #007BFF;
20-
border-radius: 10px;
21-
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
22-
padding: 20px;
19+
background: linear-gradient(to bottom, #007BFF, #72cee7);
20+
border-radius: 15px;
21+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
22+
padding: 25px;
2323
text-align: center;
24-
max-width: 300px;
24+
max-width: 320px;
2525
width: 100%;
26+
color: white;
2627
margin-bottom: 40px;
2728
}
2829

29-
h1 {
30-
font-size: 24px;
31-
color: #333;
30+
.weather-widget h1 {
31+
font-size: 28px;
32+
margin-bottom: 15px;
3233
}
3334

34-
.weather-location {
35-
margin-bottom: 20px;
35+
.weather-location h2 {
36+
font-size: 22px;
3637
}
3738

38-
h2 {
39-
font-size: 20px;
40-
color: black;
39+
.weather-location p {
40+
font-size: 16px;
41+
opacity: 0.9;
42+
margin-bottom: 15px;
4143
}
4244

4345
.weather-details h3 {
44-
font-size: 48px;
45-
color: white;
46+
font-size: 50px;
47+
margin: 10px 0;
4648
}
4749

4850
.weather-details p {
4951
font-size: 16px;
50-
color: white;
51-
margin-top: 10px;
52+
margin: 5px 0;
5253
}
5354

55+
/* Weekly forecast */
5456
.weekly-forecast {
55-
background-color: #fff;
56-
border-radius: 10px;
57-
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
57+
background-color: #ffffff;
58+
border-radius: 15px;
59+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
5860
padding: 20px;
5961
text-align: center;
60-
max-width: 600px;
62+
max-width: 700px;
6163
width: 100%;
6264
}
6365

66+
.weekly-forecast h2 {
67+
font-size: 24px;
68+
margin-bottom: 15px;
69+
}
70+
71+
/* Forecast row */
6472
.forecast-row {
6573
display: flex;
74+
flex-wrap: wrap;
6675
justify-content: space-between;
76+
gap: 15px;
6777
}
6878

6979
.day-forecast {
70-
background-color: #007BFF;
80+
flex: 1 1 100px;
7181
padding: 15px;
72-
border-radius: 5px;
82+
border-radius: 10px;
7383
text-align: center;
74-
width: 100px;
84+
color: rgb(255, 255, 255);
85+
transition: transform 0.3s ease, box-shadow 0.3s ease;
86+
}
87+
88+
/* Weather type colors */
89+
.day-forecast.sunny {
90+
background: linear-gradient(135deg, #f6d365, #fda085);
91+
}
92+
93+
.day-forecast.cloudy {
94+
background: linear-gradient(135deg, #bdc3c7, #2c3e50);
95+
}
96+
97+
.day-forecast.rainy {
98+
background: linear-gradient(135deg, #74ebd5, #ACB6E5);
99+
}
100+
101+
.day-forecast.partly {
102+
background: linear-gradient(135deg, #ff7d13, #f7c4be);
103+
}
104+
105+
/* Hover effect */
106+
.day-forecast:hover {
107+
transform: translateY(-5px) scale(1.05);
108+
box-shadow: 0 10px 20px rgba(0,0,0,0.2);
75109
}
76110

77111
.day-forecast h3 {
78-
font-size: 24px;
112+
font-size: 22px;
79113
margin-bottom: 5px;
80114
}
81115

82116
.day-forecast p {
83117
font-size: 14px;
84-
color: whitesmoke;
85-
}
118+
}
119+
120+
/* Responsive */
121+
@media (max-width: 500px) {
122+
.forecast-row {
123+
flex-direction: column;
124+
align-items: center;
125+
}
126+
.day-forecast {
127+
width: 80%;
128+
}
129+
}

0 commit comments

Comments
 (0)