Creating a liquid glass effect with CSS is a stylish way to bring depth and modern UI aesthetics to your website. This effect mimics frosted or glossy glass surfaces with fluid-like movement, often combined with blur, transparency, and gradient overlays. In this tutorial, we’ll walk step by step through building a liquid glass effect using only HTML and CSS.
#1. What Is the Liquid Glass Effect?
Liquid glass (sometimes called glassmorphism) combines three main visual properties:
- Transparency – a see-through background.
- Blur – to simulate frosted glass or foggy distortion.
- Shine or Motion – gradients or animated shapes to imitate light passing through liquid.
The result looks like a glossy, fluid pane floating above your content.
#2. Basic Setup
Start with a simple HTML container:
1<div class="glass-card">
2 <h2>Liquid Glass Effect</h2>
3 <p>This card has a liquid-like frosted glass design.</p>
4</div>
And a background to showcase the glass:
1body {
2 background: url('https://picsum.photos/1200/800') no-repeat center center/cover;
3 min-height: 100vh;
4 display: flex;
5 justify-content: center;
6 align-items: center;
7}
#3. Creating the Glass Effect
Now apply blur, transparency, and shine:
1.glass-card {
2 width: 300px;
3 padding: 2rem;
4 border-radius: 20px;
5 background: rgba(255, 255, 255, 0.15); /* semi-transparent */
6 backdrop-filter: blur(10px); /* frosted blur */
7 -webkit-backdrop-filter: blur(10px); /* Safari support */
8 border: 1px solid rgba(255, 255, 255, 0.3);
9 color: #fff;
10 text-align: center;
11 position: relative;
12 overflow: hidden;
13}
At this stage, you have a glass card effect.
#4. Adding the Liquid Shine
To simulate liquid movement, we can overlay gradients or animated blobs:
1.glass-card::before {
2 content: "";
3 position: absolute;
4 top: -50%;
5 left: -50%;
6 width: 200%;
7 height: 200%;
8 background: radial-gradient(circle at center, rgba(255,255,255,0.2), transparent 70%);
9 animation: liquidMove 6s infinite linear;
10}
11
12@keyframes liquidMove {
13 0% { transform: rotate(0deg) translate(0, 0); }
14 50% { transform: rotate(180deg) translate(50px, 50px); }
15 100% { transform: rotate(360deg) translate(0, 0); }
16}
This adds a moving highlight that mimics light refracting through liquid glass.
#5. Extra Polish
You can refine the look by adding:
- Multiple layers of gradients with different speeds for richer motion.
- Glass shadows:
1box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); - Color tints by adjusting the transparent background color.
#6. Final Result
When combined, you get a sleek CSS liquid glass card that looks glossy, fluid, and modern-perfect for dashboards, hero sections, or portfolios.
You can view the final result below:
#Conclusion
The liquid glass effect brings futuristic aesthetics to your UI using nothing more than CSS transparency, blur, and animated gradients. With these techniques, you can create floating glass panels, liquid navigation bars, or stylish modals that catch the eye.
Experiment with different colors, speeds, and gradient shapes to achieve unique glassy effects tailored to your design.