If you want to make a modern dashboard or portfolio stand out, flat colors aren’t always enough. The “Glassmorphism” trend—which mimics the look of frosted glass floating over a colorful background—adds instant premium depth to any UI.
The best part? You do not need any heavy JavaScript libraries or complex image filters to achieve this. You can build a stunning, fully responsive glass card using just a few lines of pure SCSS.
The HTML Structure
Keep the markup simple. You just need a container for your background and a card element inside it.
<div class="glass-container">
<div class="glass-card">
<h2>Premium UI</h2>
<p>This is a pure SCSS frosted glass effect.</p>
</div>
</div>
The SCSS Styling
The secret to this effect is combining a semi-transparent background color with the backdrop-filter: blur() property. We also add a subtle white border to catch the light, simulating the edge of real glass.
.glass-container {
/* A colorful background to show off the glass effect */
background: linear-gradient(135deg, #4f46e5, #ec4899);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
.glass-card {
width: 350px;
padding: 40px;
border-radius: 20px;
/* The Glass Effect */
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
/* Subtle light reflection on the edges */
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
/* Text styling */
color: #ffffff;
font-family: sans-serif;
h2 {
margin-top: 0;
font-size: 1.5rem;
}
p {
line-height: 1.6;
opacity: 0.8;
}
}
}
Browser Support
The backdrop-filter property is supported in all modern browsers. The -webkit- prefix ensures it works flawlessly on Safari and iOS devices as well.