CSS Glass Weather Card
A frosted glass weather widget with a CSS-drawn sun and cloud, the current temperature and a short forecast.
Lisbon
Partly cloudy
21°
- Mon 22°
- Tue 19°
- Wed 24°
<article class="weather-glass">
<div class="weather-glass-now">
<div>
<h3>Lisbon</h3>
<p>Partly cloudy</p>
</div>
<span class="weather-glass-icon" aria-hidden="true"></span>
</div>
<p class="weather-glass-temp">21°</p>
<ul>
<li>Mon <b>22°</b></li>
<li>Tue <b>19°</b></li>
<li>Wed <b>24°</b></li>
</ul>
</article>
.weather-glass {
width: 220px;
padding: 16px 18px;
border: 1px solid rgba(255, 255, 255, 0.35);
border-radius: 24px;
background: linear-gradient(160deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.08));
-webkit-backdrop-filter: blur(18px);
backdrop-filter: blur(18px);
color: #fff;
font-family: system-ui, sans-serif;
}
.weather-glass-now {
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.weather-glass h3 {
margin: 0;
font-size: 16px;
}
.weather-glass-now p {
margin: 2px 0 0;
font-size: 12px;
opacity: 0.85;
}
.weather-glass-icon {
position: relative;
width: 34px;
height: 34px;
margin: 4px 14px 0 0;
border-radius: 50%;
background: radial-gradient(circle at 40% 40%, #fef08a, #f59e0b);
box-shadow: 0 0 20px rgba(253, 224, 71, 0.7);
}
.weather-glass-icon::after {
content: "";
position: absolute;
top: 18px;
left: 12px;
width: 34px;
height: 14px;
border-radius: 999px;
background: #fff;
box-shadow: 8px -7px 0 2px #fff;
}
.weather-glass-temp {
margin: 2px 0 10px;
font-size: 48px;
font-weight: 300;
line-height: 1;
}
.weather-glass ul {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
margin: 0;
padding: 0;
list-style: none;
}
.weather-glass li {
display: grid;
gap: 2px;
padding: 6px;
border-radius: 10px;
background: rgba(255, 255, 255, 0.15);
font-size: 11px;
text-align: center;
}
.weather-glass b {
font-size: 14px;
}
About this CSS Glass Weather Card
This CSS Glass Weather Card is 80 lines of pure CSS (1.4 KB) with no JavaScript and no dependencies. It uses linear gradients, radial gradients, box shadows and backdrop filters. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
- linear gradients
- radial gradients
- box shadows
- backdrop filtersIncludes the -webkit- prefix for older Safari.
- CSS Grid
- Flexbox
Customize it
The colors in this snippet. Search and replace them to match your brand:
#fff#fef08a#f59e0b
How to use this glass weather card
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.weather-glassclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.