Back to Blog
CSSUI DesignWeb DevelopmentFrontend

Creating Beautiful UIs with Modern CSS

Exploring modern CSS techniques including container queries, CSS Grid, and the latest color functions to create stunning user interfaces.

Aklilu Tamirat

# Creating Beautiful UIs with Modern CSS


CSS has evolved tremendously over the past few years. In this post, I'll explore some modern techniques that can help you create stunning interfaces without relying heavily on JavaScript.


The Power of CSS Grid


CSS Grid has revolutionized how we create layouts. Here's a pattern I use frequently:



.grid-container {

display: grid;

grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));

gap: 1.5rem;

}


This creates a responsive grid that automatically adjusts based on available space.


Modern Color Functions


The new OKLCH color space provides:


  • Better perceptual uniformity
  • Predictable color manipulation
  • Wider gamut for vibrant colors

  • 
    

    :root {

    --primary: oklch(0.7 0.15 250);

    --primary-light: oklch(0.85 0.1 250);

    }


    Container Queries


    Finally, we can style based on container size, not just viewport:


    
    

    @container (min-width: 400px) {

    .card {

    display: flex;

    flex-direction: row;

    }

    }


    Glass Morphism Effect


    Create beautiful frosted glass effects:


    
    

    .glass {

    background: rgba(255, 255, 255, 0.1);

    backdrop-filter: blur(10px);

    border: 1px solid rgba(255, 255, 255, 0.2);

    border-radius: 1rem;

    }


    Conclusion


    Modern CSS gives us powerful tools to create beautiful, responsive interfaces. The key is to stay updated with new features and know when to use them.


    What CSS techniques are you excited about? Share in the comments!